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` by diegomarquezp · Pull Request #2415 · googleapis/java-bigtable

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

Conversation

@diegomarquezp

@diegomarquezp diegomarquezp commented Nov 14, 2024 •
edited
Loading

Uh oh!

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

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).

Note: https://cloud.google.com/bigtable/docs/reference/sql/data-types#timestamp_type implies that nanosecond precision will be ignored.

Sorry, something went wrong.

Uh oh!

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

All reactions
diegomarquezp added 2 commits November 14, 2024 16:27
@diegomarquezp
feat: introduce java.time to java-bigtable
71aa9a8
@diegomarquezp
fix tests i
62dd45f
@product-auto-label product-auto-label Bot added size: l Pull request size is large. api: bigtable Issues related to the googleapis/java-bigtable API. labels Nov 14, 2024
cloud-java-bot and others added 13 commits November 14, 2024 16:55
@cloud-java-bot
chore: generate libraries at Thu Nov 14 16:52:48 UTC 2024
959a469
@diegomarquezp
fix tests
ca275dc
@diegomarquezp
make protobuf timestamp conversion fully precise (epoch seconds + nanos)
a7746ad
@diegomarquezp
Merge branch 'introduce-java-time' of https://github.com/googleapis/j…
321c952
…ava-bigtable into introduce-java-time
@diegomarquezp
resolve to microsecond level
d25d6ef
@diegomarquezp
Revert "make protobuf timestamp conversion fully precise (epoch secon…
796aa4b
…ds + nanos)"

This reverts commit a7746ad.
@diegomarquezp
restore ms precision
a7e6167
@diegomarquezp
fix precision in tests
0072191
@diegomarquezp
fix tests
99600a6
@diegomarquezp
fix tests, clirr
3765977
@diegomarquezp
fix test proxy
38b13e9
@diegomarquezp
format
f6efe6b
@diegomarquezp
format ii
41bc6ea
@diegomarquezp diegomarquezp added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 20, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 20, 2024
@diegomarquezp
fix ITs
e06a104
@diegomarquezp

diegomarquezp commented Nov 22, 2024

Copy link
Copy Markdown
Contributor Author

ci / windows failing in several PRs - see this job from #2425

All reactions

Sorry, something went wrong.

Uh oh!

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

diegomarquezp
diegomarquezp commented Nov 22, 2024
View reviewed changes
Comment thread google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/common/Type.java Resolved

Uh oh!

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

diegomarquezp
diegomarquezp commented Nov 22, 2024
View reviewed changes
Comment thread google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/SqlType.java Resolved

Uh oh!

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

diegomarquezp
diegomarquezp commented Nov 22, 2024
View reviewed changes
Comment thread google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/sql/Statement.java Resolved

Uh oh!

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

diegomarquezp
diegomarquezp commented Nov 22, 2024
View reviewed changes
Comment thread ...rc/main/java/com/google/cloud/bigtable/data/v2/stub/RateLimitingServerStreamingCallable.java Resolved

Uh oh!

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

@diegomarquezp
fix it, timestamp precision
fc920b0
@diegomarquezp
diegomarquezp marked this pull request as ready for review November 22, 2024 02:12
@diegomarquezp
diegomarquezp requested review from a team November 22, 2024 02:12
@diegomarquezp diegomarquezp removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Dec 7, 2024
mutianf
mutianf reviewed Dec 10, 2024
View reviewed changes

@mutianf mutianf 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.

I reviewed the following:

  • common/Type.java
  • data/v2/BigtableDataSettings.java
  • data/v2/stub
  • data/v2/metrics
  • gaxx/retrying
  • and tests related to these changes.

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
Comment thread ...d-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracer.java
}
}

public void attemptFailed(Throwable error, Duration delay) {

@mutianf mutianf Dec 10, 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.

Instead of deleting this method, should attemptFailled call attemptFailedDuration?

Sorry, something went wrong.

Uh oh!

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

All reactions

@diegomarquezp diegomarquezp Dec 11, 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.

We moved all references in gax to attemptFailedDuration
googleapis/sdk-platform-java#1872

However it still makes sense to keep both. I'll push a commit with this.

Sorry, something went wrong.

Uh oh!

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

All reactions

@diegomarquezp diegomarquezp Dec 11, 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.

I noticed our tracking sheet has a new comment in there. Confirmed it should be as you pointed out.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread ...e/src/test/java/com/google/cloud/bigtable/data/v2/stub/BigtableBatchingCallSettingsTest.java
BatchingSettings.newBuilder()
.setElementCountThreshold(10L)
.setRequestByteThreshold(20L)
.setDelayThreshold(Duration.ofMillis(5))

@mutianf mutianf Dec 10, 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.

Im wondering if we should keep the test code the same so that we can verify these settings are ported to the new settings correctly? We can leave a todo to update them in a separate PR.

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
Comment thread ...gtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/CompositeTracerTest.java
public void testAttemptFailed() {
RuntimeException error = new RuntimeException();
Duration delay = Duration.ofMillis(10);
compositeTracer.attemptFailed(error, delay);

@mutianf mutianf Dec 10, 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.

same here, I think we should keep calling attemptFailed and verify attemptFailedDuration gets called?

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
diegomarquezp added 2 commits December 11, 2024 10:51
@diegomarquezp
restore metrics
540b19d
@diegomarquezp
use threeten methods in tests
ce6a279
@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 Dec 11, 2024
@diegomarquezp
diegomarquezp requested a review from mutianf December 11, 2024 17:03
mutianf
mutianf approved these changes Dec 11, 2024
View reviewed changes
jackdingilian
jackdingilian reviewed Dec 11, 2024
View reviewed changes

@jackdingilian jackdingilian 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.

I reviewed the following files and their corresponding tests:
internal/AbstractProtoStructReader.java
internal/ResultSetImpl.java
models/ChangeStreamMutation.java
models/ChangeStreamRecordAdapter.java
models/Heartbeat.java
models/ReadChangeStreamQuery.java
models/sql/SqlType.java
models/sql/Statement.java
models/sql/StructReader.java
changestream/ChangeStreamStateMachine.java

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread ...ud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamMutation.java Outdated

/** This method is obsolete. Use {@link #setCommitTime(java.time.Instant)} instead. */
@ObsoleteApi("Use setCommitTime(java.time.Instant) instead")
abstract Builder setCommitTimestamp(org.threeten.bp.Instant commitTimestamp);

@jackdingilian jackdingilian Dec 11, 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 think it would be better to remove the threeten setter, only store it as java.time.Instant, and then reverse the overload of getCommitTime(stamp) above.

The builder is fully internal, we just need to maintain backwards compatibility for the getter

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

@diegomarquezp diegomarquezp Dec 11, 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.

Thanks for the catch. This was indeed stated in the tracking sheet. I'll update this as an internal class.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread ...ud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamMutation.java Outdated
abstract Builder setToken(@Nonnull String token);

abstract Builder setEstimatedLowWatermark(Instant estimatedLowWatermark);
Builder setLowWatermarkTime(java.time.Instant estimatedLowWatermark) {

@jackdingilian jackdingilian Dec 11, 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.

Same question as for commit time. Also if we need to keep both setters this should be 'setEstimatedLowWatermarkTime'

Sorry, something went wrong.

Uh oh!

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

All reactions

@diegomarquezp diegomarquezp Dec 11, 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.

Yes, done.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread ...ud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamMutation.java Outdated
}

/** This method is obsolete. Use {@link #setLowWatermarkTime(java.time.Instant)} instead. */
@ObsoleteApi("Use setEstimatedLowWatermarkInstant(java.time.Instant) instead")

@jackdingilian jackdingilian Dec 11, 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.

setEstimatedLowWatermarkInstant should be setEstimatedLowWatermarkTime

Sorry, something went wrong.

Uh oh!

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

All reactions

@diegomarquezp diegomarquezp Dec 11, 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 will be removed since it's an internal api change as per #2415 (comment)

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Heartbeat.java Outdated

/** This method is obsolete. Use {@link #getEstimatedLowWatermarkInstant()} instead. */
@ObsoleteApi("Use getEstimatedLowWatermarkInstant() instead")
public abstract org.threeten.bp.Instant getEstimatedLowWatermark();

@jackdingilian jackdingilian Dec 11, 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.

Same question as in ChangeStreamMutation. Wouldn't it be better to store this as java.time.Instant?

Sorry, something went wrong.

Uh oh!

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

All reactions

@diegomarquezp diegomarquezp Dec 11, 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.

Yes, done.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Heartbeat.java Outdated

@InternalApi("Intended for use by the BigtableIO in apache/beam only.")
public abstract Instant getEstimatedLowWatermark();
public java.time.Instant getEstimatedLowWatermarkInstant() {

@jackdingilian jackdingilian Dec 11, 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.

In ChangeStreamMutation we call this getEstimatedLowWatermarkTime. We should be consistent w that naming here

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

@diegomarquezp diegomarquezp Dec 11, 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.

Removed as this is an internal api. I only kept the java.time version

Sorry, something went wrong.

Uh oh!

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

All reactions
@diegomarquezp
convert to internal changes in change stream classes
51657d8
@product-auto-label product-auto-label Bot added size: m Pull request size is medium. and removed size: l Pull request size is large. labels Dec 11, 2024
@diegomarquezp
diegomarquezp requested a review from jackdingilian December 11, 2024 20:24
jackdingilian
jackdingilian reviewed Dec 11, 2024
View reviewed changes
Comment thread ...ud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/ChangeStreamMutation.java Outdated

/** Get the commit timestamp of the current mutation. */
public abstract Instant getCommitTimestamp();
public abstract java.time.Instant getCommitTimestamp();

@jackdingilian jackdingilian Dec 11, 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.

We still need the threeten getter here, since this is used by beam users. Same for Heartbeat below

Sorry, something went wrong.

Uh oh!

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

All reactions

@jackdingilian jackdingilian Dec 11, 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.

And for estimatedLowWatermark

Sorry, something went wrong.

Uh oh!

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

All reactions
diegomarquezp added 2 commits December 12, 2024 10:40
@diegomarquezp
Revert "convert to internal changes in change stream classes"
06501e7
This reverts commit 51657d8.
@diegomarquezp
convert to internal changes in change stream classes ii
ed0213d
@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 Dec 12, 2024
@diegomarquezp

diegomarquezp commented Dec 12, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

@jackdingilian thanks for the review and apologies for the misunderstanding. This time I got it right:

  • ChangeStreamMutation.Builder setters directly switched to java.time, no overloads.
  • ChangeStreamMutation getters have been swapped: java.time is abstract and threeten delegates.
  • We respect the java.time name getEstimatedLowWatermarkTime (the Instant suffix was corrected)
  • Heartbeat getters have been swapped: java.time is abstract and threeten delegates.
All reactions

Sorry, something went wrong.

Uh oh!

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

@diegomarquezp
diegomarquezp requested a review from jackdingilian December 12, 2024 16:05
jackdingilian
jackdingilian approved these changes Dec 12, 2024
View reviewed changes
@diegomarquezp
fix clirr
5994e4f
@diegomarquezp diegomarquezp added the automerge Merge the pull request once unit tests and other checks pass. label Dec 13, 2024
@diegomarquezp
Merge branch 'main' into introduce-java-time
7ce813f
@gcf-merge-on-green
gcf-merge-on-green Bot merged commit bb96c3e into main Dec 13, 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 13, 2024
@gcf-merge-on-green
gcf-merge-on-green Bot deleted the introduce-java-time branch December 13, 2024 19:14
@diegomarquezp diegomarquezp mentioned this pull request May 8, 2026
[java-bigtable] Update tests to use java.time methods googleapis/google-cloud-java#13066
Open
@release-please release-please Bot mentioned this pull request Dec 17, 2024
chore(main): release 2.51.0 #2453
Merged
@release-please release-please Bot mentioned this pull request Dec 15, 2025
chore(protobuf-4.x-rc): release 2.71.0-rc1 #2726
Merged
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

3 more reviewers
@lqiu96 lqiu96 lqiu96 approved these changes
@mutianf mutianf mutianf approved these changes
@jackdingilian jackdingilian jackdingilian 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: bigtable Issues related to the googleapis/java-bigtable 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.

7 participants

@diegomarquezp @lqiu96 @mutianf @jackdingilian @igorbernstein2 @yoshi-kokoro @cloud-java-bot
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.