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

[FLINK-32689] Improve validation of local time zone #23090

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

twalthr
Copy link
Contributor

@twalthr twalthr commented Jul 27, 2023

What is the purpose of the change

This fixes the insufficient validation of ZoneId for setting local time zones.

Brief change log

  • It ensures that no information is lost when converting between TimeZone and ZoneId
  • Now time zones such as UT-1 fail with an error.
  • ZoneOffset is converted to GMT zone in order to avoid issues where the offset is lost when converting between TimeZone and ZoneId

Verifying this change

This change added tests and can be verified as follows:

  • TableConfigTest

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

@flinkbot
Copy link
Collaborator

flinkbot commented Jul 27, 2023

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@dawidwys
Copy link
Contributor

What are the offending places? Wouldn't it be better to simply remove all places where we convert to java.util.TimeZone? From a quick look, there is only one such place (RexNodeExtractor) and even there in the end we convert back to ZoneId.

@twalthr
Copy link
Contributor Author

twalthr commented Jul 27, 2023

@dawidwys I totally agree that ZoneId would be enough everywhere. But this is currently not feasible. Checkout DateTimeUtils and the code generation. Let's open a followup issue for this. In general, it makes sense to limit input such that any util (backed by legacy or new zones) can work with it. I just saw that even FileSystemTableFactory needs to be updated.

@dawidwys
Copy link
Contributor

But neither DateTimeUtils nor FileSystemTableFactory use the time zone setting from TableConfig.

  • FileSystemTableFactory uses: SINK_PARTITION_COMMIT_WATERMARK_TIME_ZONE, which has separate validation and doesn't go through ZoneId.
  • DateTimeUtils are used in builtin functions which is applied on incoming data.

I am not insisting on making the change now though...

Copy link
Contributor

@dawidwys dawidwys left a comment

Choose a reason for hiding this comment

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

LGTM, since it improves the validation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants