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

feat: implement wasNull for BigQueryResultSet #3650

Merged
merged 7 commits into from
Jan 30, 2025
Merged

feat: implement wasNull for BigQueryResultSet #3650

merged 7 commits into from
Jan 30, 2025

Conversation

PhongChuong
Copy link
Contributor

@PhongChuong PhongChuong commented Jan 25, 2025

  • Implement wasNull as defined by java.sql.ResultSet for BigQueryResultSet.
  • Add a new unittest file for BigQueryResultSet
  • Add unittest for BigQueryResultSet getters for both FieldValue type buffer and read API type buffer
  • Perform minor refactoring in BigQueryResultSet

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 #3648 ☕️

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: bigquery Issues related to the googleapis/java-bigquery API. labels Jan 25, 2025
@PhongChuong PhongChuong marked this pull request as ready for review January 27, 2025 15:21
@PhongChuong PhongChuong requested a review from a team as a code owner January 27, 2025 15:21
Copy link
Contributor

@whuffman36 whuffman36 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@shollyman shollyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code seems fairly invasive with the hasNull plumbing, and I worry it'll be prone to error. Could we move the hasNull state computation higher up into when we do cursor advancement? Then it's just something like (pseudocode) for field in row.fields { if field.isNull() { hasNull = true }}?

@shollyman
Copy link
Contributor

This code seems fairly invasive with the hasNull plumbing, and I worry it'll be prone to error. Could we move the hasNull state computation higher up into when we do cursor advancement? Then it's just something like (pseudocode) for field in row.fields { if field.isNull() { hasNull = true }}?

After reading more about java.sql.resultset, it seems my previous understanding was wrong. It's not whether the previous row had a null, its if the latest field fetched had a null, which does yield more complexity here.

Copy link
Contributor

@shollyman shollyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking this LGTM, modulo some comment/docs updates to clarify some of the details here we discussed out of band.

@PhongChuong
Copy link
Contributor Author

Thanks for the reviews.

@PhongChuong PhongChuong merged commit c7ef94b into main Jan 30, 2025
16 checks passed
@PhongChuong PhongChuong deleted the i3648 branch January 30, 2025 19:56
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. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResultSet getXXX returns default value instead of null for nullable fields
3 participants