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: introduce java.time methods and variables #3586

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

diegomarquezp
Copy link
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).

@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 Nov 19, 2024
Comment on lines +349 to 354
/**
* Creates a {@code QueryParameterValue} object with a type of INTERVAL. This method is obsolete.
* Use {@link #interval(String)} instead.
*/
@ObsoleteApi("Use interval(String) instead")
public static QueryParameterValue interval(PeriodDuration value) {
Copy link
Contributor Author

@diegomarquezp diegomarquezp Nov 20, 2024

Choose a reason for hiding this comment

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

@lqiu96 I'm not sure if this makes sense. PeriodDuration is part of Threeten Extra which only accepts java.time objects. The class purpose is to blend a Period (years to days) with a Duration (hours to nanos).
I'm guessing we may want to keep it since it's just a helper class that happens to be from ThreeTen but not meant to be a backport (since this is not available in the JDK).

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. Ideally, I think we should try to migrate away from threeten-extra as well. I'm guessing from your comment that PeriodDuration doesn't exist in the JDK so we can't build a 1:1 method signature replacement with the available JDK alternative.

If interval(String) has the same behavior, then I think that probably can use that as the alternative. But would be a question for the Bigquery SMEs to confirm that they have the same behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. @PhongChuong can you please confirm whether marking this threeten-extra-based method as @ObsoleteApi makes sense? And does interval(String) as the suggested alternative make sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

@diegomarquezp , marking it as @ObsoleteApi and the suggested alternative makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

@diegomarquezp diegomarquezp requested a review from lqiu96 November 20, 2024 02:41
@diegomarquezp diegomarquezp marked this pull request as ready for review November 20, 2024 02:41
@diegomarquezp diegomarquezp requested review from a team as code owners November 20, 2024 02:41
@diegomarquezp diegomarquezp merged commit 31fb15f into main Dec 3, 2024
17 checks passed
@diegomarquezp diegomarquezp deleted the introduce-java-time branch December 3, 2024 00:27
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: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants