-
Notifications
You must be signed in to change notification settings - Fork 126
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
Conversation
.github/workflows/scorecard.yml
Outdated
There was a problem hiding this comment.
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.
google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryResultImpl.java
Show resolved
Hide resolved
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryResultImpl.java
Show resolved
Hide resolved
google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryResultImplTest.java
Show resolved
Hide resolved
assertEquals(1, rs.getInt("IntegerField")); | ||
assertEquals(1534680695123L, rs.getTimestamp("TimestampField").getTime()); | ||
assertEquals( | ||
java.sql.Date.valueOf("2018-08-18").toLocalDate(), rs.getDate("DateField").toLocalDate()); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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:
Fixes #3655 ☕️