GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: introduce `java.time` methods and variables by diegomarquezp · Pull Request #2780 · googleapis/java-bigquerystorage

This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Conversation

@diegomarquezp

@diegomarquezp diegomarquezp commented Nov 20, 2024

Copy link
Copy Markdown
Contributor

This PR introduces java.time alternatives to existing org.threeten.bp.* methods, as well as switching internal variables (if any) to java.time

The main constraint is to keep the changes backwards compatible, so for each existing threeten method "method1(org.threeten.bp.Duration)" we will add an alternative with a Duration (or Timestamp when applicable) suffix: "method1Duration(java.time.Duration)".

For most cases, the implementation will be held in the java.time method and the old threeten method will just delegate the call to it. However, for the case of abstract classes, the implementation will be kept in the threeten method to avoid breaking changes (i.e. users that already overloaded the method in their user code).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@diegomarquezp
feat: introduce java.time methods and variables
7feaaa8
@product-auto-label product-auto-label Bot added size: l Pull request size is large. api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. labels Nov 20, 2024
diegomarquezp added 2 commits November 20, 2024 16:27
@diegomarquezp
fix javadoc
9178b4b
@diegomarquezp
add clirr ignores
83256e7
@diegomarquezp

diegomarquezp commented Nov 22, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@lqiu96 This check (java 8 only) is failing with

Error:    JsonToProtoMessageTest.testTimestampRepeated:890 expected:<test_string_repeated: 10
test_string_t_z_repeated: 1648493279010000
test_long_repeated: 1687984085000000
test_int_repeated: 153480695
test_float_repeated: [15346](https://github.com/googleapis/java-bigquerystorage/actions/runs/11942130315/job/33288467778?pr=2780#step:6:15347)8069500
test_offset_repeated: 1649135171000000
test_timezone_repeated: 1649174771000000
test_saformat_repeated: 1534680660000000
> but was:<test_string_repeated: 10
test_string_t_z_repeated: 1648493279010000
test_long_repeated: 1687984085000000
test_int_repeated: [15348](https://github.com/googleapis/java-bigquerystorage/actions/runs/11942130315/job/33288467778?pr=2780#step:6:15349)0695
test_float_repeated: 153468069500
test_offset_repeated: 1649149571000000
test_timezone_repeated: 1649174771000000
test_saformat_repeated: 1534680660000000
>

The problem is with test_offset_repeated; it's the same as googleapis/sdk-platform-java#3330 (comment), but the difference here is that we use appendOffset() with a default zone string of +00:00, while the one in appendZoneOrOffsetId() is Z

java-bigquerystorage/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/JsonToProtoMessage.java

Lines 95 to 102 in 5f1b30a

.optionalStart()
.appendOffset("+HH:MM", "+00:00")
.optionalEnd()
.optionalStart()
.appendZoneText(TextStyle.SHORT)
.optionalEnd()
.optionalStart()
.appendLiteral('Z')

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@diegomarquezp
diegomarquezp marked this pull request as ready for review November 22, 2024 18:41
@diegomarquezp
diegomarquezp requested review from a team, hongalex and lqiu96 November 22, 2024 18:41
@diegomarquezp
use java 8 fix for offset parsing
525d5e1
diegomarquezp
diegomarquezp commented Nov 22, 2024
View reviewed changes
Comment thread ...d-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/JsonToProtoMessage.java
Comment on lines 93 to 102
.appendLiteral(' ')
.optionalEnd()
.optionalStart()
.appendOffset("+HH:MM", "+00:00")
.appendZoneOrOffsetId()
.optionalEnd()
.optionalStart()
.appendZoneText(TextStyle.SHORT)
.optionalEnd()
.optionalStart()
.appendLiteral('Z')
.optionalEnd()
.toFormatter()
.withZone(ZoneOffset.UTC);

@diegomarquezp diegomarquezp Nov 22, 2024

Copy link
Copy Markdown
Contributor Author

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.

This fix works for the current tests. Note that the literal Z is dropped from the config because appendZoneOrOffsetId() uses Z as the no-zone string

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lqiu96 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@diegomarquezp diegomarquezp Nov 25, 2024

Copy link
Copy Markdown
Contributor Author

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.

Added a test for +00:00 in 260c835

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@diegomarquezp
expand offset test
260c835
lqiu96
lqiu96 reviewed Nov 26, 2024
View reviewed changes
Comment thread ...igquerystorage/src/main/java/com/google/cloud/bigquery/storage/util/TimeConversionUtils.java

package com.google.cloud.bigquery.storage.util;

public class TimeConversionUtils {

@lqiu96 lqiu96 Nov 26, 2024

Copy link
Copy Markdown
Member

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.

Why is this added in BQStorage and not used from sdk-platform-java?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@diegomarquezp diegomarquezp Nov 27, 2024

Copy link
Copy Markdown
Contributor Author

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.

They are functions only used in BQS so far (confirmed other repos don't need them). However, the reason is simply because it's faster to implement here than waiting for a new release of gax with the utilities we have here. What if we follow up in gax and temporarily have these functions in this repo?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lqiu96 lqiu96 Dec 4, 2024

Copy link
Copy Markdown
Member

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.

What if we follow up in gax and temporarily have these functions in this repo?

Sure. Can we make this class package-private until we migrate this to Gax? Can you also create an issue in sdk-platform-java for this?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@diegomarquezp diegomarquezp Dec 4, 2024

Copy link
Copy Markdown
Contributor Author

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 internally, left as @InternalApi, referencing the new issue in sdk-platform: https://github.com/googleapis/sdk-platform-java/issues/3412

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
lqiu96
lqiu96 reviewed Nov 26, 2024
View reviewed changes
Comment thread google-cloud-bigquerystorage/clirr-ignored-differences.xml Resolved

Uh oh!

There was an error while loading. Please reload this page.

lqiu96
lqiu96 reviewed Nov 26, 2024
View reviewed changes
Comment thread google-cloud-bigquerystorage/clirr-ignored-differences.xml
<to>java.time.Duration</to>
</difference>
<difference>
<!--The retryDelay field is used by ApiResultRetryAlgorithm, which is marked as @InternalApi-->

@lqiu96 lqiu96 Nov 26, 2024

Copy link
Copy Markdown
Member

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.

Errors$IsRetryableStatusResult is still marked as public even if it's only used by ApiResultRetryAlgorithm in the BQStorage SDK. I think it's still accessible which is problematic.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@diegomarquezp diegomarquezp Nov 27, 2024

Copy link
Copy Markdown
Contributor Author

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.

@PhongChuong what's the rationale of Errors$IsRetryableStatusResult being public? Is it similar to the case of ApiResultRetryAlgorithm "visible for technical reasons"?
Also, does it make sense to change their datatypes directly, without threeten alternatives as done currently?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@PhongChuong PhongChuong Nov 28, 2024

Copy link
Copy Markdown
Contributor

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 don't know the historical reason as to why it is public but from the code, I would assume that is it "visible for technical reasons". Specifically, while IsRetryableStatusResult is public, it seems to be only used in ApiResultRetryAlgorithm and it is not part of the return value. I think it would be okay to change the datatype directly here.

@yirutang , what do you think?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@yirutang yirutang Dec 3, 2024

Copy link
Copy Markdown
Contributor

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 am fine making it private. I don't think external user should use it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

diegomarquezp reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
lqiu96
lqiu96 reviewed Nov 26, 2024
View reviewed changes
Comment thread google-cloud-bigquerystorage/src/test/proto/jsonTest.proto Resolved

Uh oh!

There was an error while loading. Please reload this page.

@diegomarquezp
diegomarquezp requested a review from lqiu96 November 27, 2024 22:31
@PhongChuong
PhongChuong self-requested a review November 28, 2024 11:01
PhongChuong
PhongChuong reviewed Nov 28, 2024
View reviewed changes

@PhongChuong PhongChuong left a comment

Copy link
Copy Markdown
Contributor

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.

Overall the changes looks good. Thank you for the PR, it looks like a lot of work tracking down all the changes needed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google-cloud-bigquerystorage/clirr-ignored-differences.xml
<to>java.time.Duration</to>
</difference>
<difference>
<!--The retryDelay field is used by ApiResultRetryAlgorithm, which is marked as @InternalApi-->

@PhongChuong PhongChuong Nov 28, 2024

Copy link
Copy Markdown
Contributor

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 don't know the historical reason as to why it is public but from the code, I would assume that is it "visible for technical reasons". Specifically, while IsRetryableStatusResult is public, it seems to be only used in ApiResultRetryAlgorithm and it is not part of the return value. I think it would be okay to change the datatype directly here.

@yirutang , what do you think?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@diegomarquezp
diegomarquezp requested a review from PhongChuong December 3, 2024 20:46
PhongChuong
PhongChuong approved these changes Dec 4, 2024
View reviewed changes
lqiu96
lqiu96 approved these changes Dec 4, 2024
View reviewed changes

@lqiu96 lqiu96 left a comment

Copy link
Copy Markdown
Member

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.

LGTM. Added a small comment if you could address

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@diegomarquezp diegomarquezp mentioned this pull request Apr 1, 2026
[sdk-platform-java] TimeConversionUtils should include LocalTime and LocalDateTime conversions googleapis/google-cloud-java#12403
Closed
@diegomarquezp
makr time conversion utils as internal
2ac7606
@diegomarquezp diegomarquezp added the automerge Merge the pull request once unit tests and other checks pass. label Dec 4, 2024
@diegomarquezp
Merge branch 'main' into introduce-java-time
9e13c15
@gcf-merge-on-green
gcf-merge-on-green Bot merged commit 8dd66d5 into main Dec 5, 2024
@gcf-merge-on-green gcf-merge-on-green Bot removed the automerge Merge the pull request once unit tests and other checks pass. label Dec 5, 2024
@gcf-merge-on-green
gcf-merge-on-green Bot deleted the introduce-java-time branch December 5, 2024 02:10
@release-please release-please Bot mentioned this pull request Dec 5, 2024
chore(main): release 3.11.0 #2781
Merged
@release-please release-please Bot mentioned this pull request Dec 15, 2025
chore(protobuf-4.x-rc): release 3.20.0-rc1 #3127
Merged
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@hongalex hongalex Awaiting requested review from hongalex
3 more reviewers
@yirutang yirutang yirutang left review comments
@lqiu96 lqiu96 lqiu96 approved these changes
@PhongChuong PhongChuong PhongChuong approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. size: l Pull request size is large.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@diegomarquezp @lqiu96 @yirutang @PhongChuong
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.