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(bigquery): Implement getArray in BigQueryResultImpl #3693

Merged
merged 11 commits into from
Mar 7, 2025
Merged

Conversation

whuffman36
Copy link
Contributor

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

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/java-bigquery API. labels Feb 25, 2025
@whuffman36 whuffman36 changed the title Implement getArray in BigQueryResultImpl feat(bigquery):Implement getArray in BigQueryResultImpl Feb 25, 2025
@whuffman36 whuffman36 self-assigned this Feb 25, 2025
@whuffman36 whuffman36 changed the title feat(bigquery):Implement getArray in BigQueryResultImpl feat(bigquery): Implement getArray in BigQueryResultImpl Feb 26, 2025
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These files changes were added automatically to the PR by a bot...not sure if I can revert them or if this is expected behavior, it seems like they are just updating some dependency versions.

@whuffman36 whuffman36 marked this pull request as ready for review February 26, 2025 00:46
@whuffman36 whuffman36 requested review from a team as code owners February 26, 2025 00:46
Copy link
Contributor

Choose a reason for hiding this comment

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

Both of the modified integration tests exercise the non-ReadAPI path. Can you check if we have an existing integration test that exercise the read API path and augment the test to validate getArray on it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a new IT test to test the ReadAPI path. Turns out that path had not been tested yet, and so the expected responses for getDate() and getTime() were inaccurate. The ReadAPI path returns the Date and Time objects in local format instead of UTC format.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed offline, it looks more like my local machine had a different local time than that of the VM running the kokoro, resulting in different dates and time objects. This has been resolved.

@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Mar 3, 2025
assertEquals(1, rs.getInt("IntegerField"));
assertEquals(1534680695123L, rs.getTimestamp("TimestampField").getTime());
assertEquals(
java.sql.Date.valueOf("2018-08-18").toLocalDate(), rs.getDate("DateField").toLocalDate());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For whatever reason, when using the ReadApi, the getDate() function returns the date as local instead of UTC. The Date object is different when converted from FieldValue, like in testExecuteSelectSinglePageTableRow() as opposed to from Integer in this case when reading from Arrow. The raw epoch time values are the same, but the FieldValue conversion is in UTC format, while the Integer conversion is in local format.

The same is true for the getTime() function.

Screenshot to show the difference: https://screenshot.googleplex.com/6wGhSehFwRV6wdC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed offline, it looks more like my local machine had a different local time than that of the VM running the kokoro, resulting in different dates and time objects. This has been resolved.

@whuffman36 whuffman36 merged commit e2a3f2c into main Mar 7, 2025
17 checks passed
@whuffman36 whuffman36 deleted the getArray branch March 7, 2025 22:26
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.

Implement getArray() in BigQueryResultImpl
3 participants