ShawnGarello opened a new pull request, #29839:
URL: https://github.com/apache/flink/pull/29839

   ## What is the purpose of the change
   
   PyFlink's `TableResult.collect()` changes `TIMESTAMP` values that aren't a 
plain instant in the client's time zone: a time in a DST gap moves by an hour, 
and times before 1902 move by the difference between two LMT offsets (examples 
in FLINK-41307). The value went through `Timestamp.valueOf` in the JVM zone and 
then `datetime.fromtimestamp` in the Python zone. This change sends the wall 
clock as microseconds since 1970-01-01T00:00, as DATE and TIME already are, so 
no time zone is involved. It also keeps the microseconds, which the old path 
cut to milliseconds.
   
   ## Brief change log
   
     - `PythonBridgeUtils` pickles a `TIMESTAMP` as the microseconds of its 
`LocalDateTime` instead of as a `java.sql.Timestamp`.
     - `pickled_bytes_to_python_converter` builds the naive `datetime` from 
those microseconds instead of calling `from_sql_type`, which uses the local 
zone.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
     - `PickledBytesConverterTests.test_timestamp_ignores_local_time_zone` in 
`test_utils.py` decodes DST-gap, pre-1902, pre-1970 and boundary values with 
`TZ=America/Los_Angeles`.
     - 
`StreamTableEnvironmentTests.test_collect_timestamp_ignores_local_time_zone` in 
`test_table_environment_api.py` collects the ticket's values, plus one nested 
in a `ROW`, with the Python process in `America/Los_Angeles`.
   
   Both fail without the change.
   
   ## 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
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code 2.1.319 (Claude Opus 5.5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to