Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support empty array in _from_api_repr_struct #2010

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

TommyDew42
Copy link

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #2009 🦕

@TommyDew42 TommyDew42 requested review from a team as code owners September 3, 2024 08:43
@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Sep 3, 2024
Copy link

conventional-commit-lint-gcf bot commented Sep 3, 2024

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Sep 3, 2024
@shollyman shollyman requested review from chalmerlowe and Linchin and removed request for agrawal-siddharth September 9, 2024 20:21
@chalmerlowe chalmerlowe added the kokoro:run Add this label to force Kokoro to re-run the tests. label Nov 26, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Nov 26, 2024
@chalmerlowe
Copy link
Collaborator

@TommyDew42 Thank you for suggesting a code improvement. It does appear that we may need to make our code logic more robust in that area.

Right now, this PR does not appear to have a matching test.
Issue #2009 refers to the case where the ArrayQueryParameter is empty.

The ArrayQueryParameter class must take a StructQueryParameterType if the values is an empty array (docstring):

If the type is 'STRUCT'/'RECORD' and values is empty,
the exact item type cannot be deduced, thus a StructQueryParameterType
instance needs to be passed in.

A test similar to test_from_api_repr_w_struct_type, but with an empty values array, may be suitable.

With one or more test cases to exercise the logic, we will also need to ensure that coverage passes:
https://github.com/googleapis/python-bigquery/blob/main/CONTRIBUTING.rst

If you are not sure how to proceed with producing tests, let us know, we might be able to offer some guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ArrayQueryParameter.from_api_repr does not support empty array
4 participants