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

Named parameters do not work with records/subfields #207

Closed
zlavallee opened this issue Mar 2, 2020 · 5 comments · Fixed by #718
Closed

Named parameters do not work with records/subfields #207

zlavallee opened this issue Mar 2, 2020 · 5 comments · Fixed by #718
Assignees
Labels
api: bigquery Issues related to the googleapis/java-bigquery API. priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@zlavallee
Copy link

Named parameters do not work when executing a query with Record type attributes. The FieldValueList does not pass the schema to the FieldValue and then to the FieldValueList after FieldValue.getRecordValue() is called. This means the schema instance is no longer available and the FieldValueList.get(String name) method no longer works. Also, due to encapsulation, the schema cannot be provided to the FieldValueList once it has been created.

The expected behavior would be passing the schema to the FieldValueList when it is a record type so that named parameters continue to work.

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/java-bigquery API. label Mar 2, 2020
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Mar 3, 2020
@pmakani pmakani added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed triage me I really want to be triaged. labels Mar 4, 2020
@stephaniewang526 stephaniewang526 self-assigned this Mar 22, 2020
@stephaniewang526
Copy link
Contributor

Can you provide us with the code and BigQuery version you're using for us to reproduce the issue?

@zlavallee
Copy link
Author

Version 1.106.0.

To reproduce, execute a query and get a iterable of FieldValueList.

fieldValueList.get("record_field").getRecordValue().get("field_on_record");

The schema object is not passed on to the nested FieldValueList for the field on the record.

@stephaniewang526 stephaniewang526 removed their assignment Apr 7, 2020
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Jul 6, 2020
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Aug 29, 2020
@stephaniewang526
Copy link
Contributor

@shollyman PTAL

@shollyman
Copy link
Contributor

Seems like named query parameters are a bit of a red herring here (or the reporter is simply refering to named fields of a record's sub-schema). The issue is all down to nested schema propagation, which we're not doing here correctly.

e.g. if you get() a record type from fieldvaluelist and schema is present, we should access the corresponding schema field and propagate the nested schema (or fieldlist) when returning the data object. Unclear without doing more work if we need to consider other accessors/constructors patterns.

@pmakani pmakani removed the 🚨 This issue needs some love. label Sep 2, 2020
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Sep 2, 2020
@bartlomiejgraczyk
Copy link

bartlomiejgraczyk commented Apr 4, 2024

The issue still occurs in com.google.cloud.google-cloud-bigquery:2.38.2.
fieldValueList.get("repeatedValue").getRepeatedValue().get(0).getRecordValue().get("nestedField")

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/java-bigquery API. priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants