bgeng777 opened a new pull request, #29526: URL: https://github.com/apache/flink/pull/29526
## What is the purpose of the change Fix [FLINK-41032](https://issues.apache.org/jira/browse/FLINK-41032): `Table.to_pandas()` currently returns `object` dtypes for every column when the result is empty. Preserve schema-derived dtypes, including timestamp precision and local timezone information. ## Brief change log - Build empty results from the Arrow schema and share pandas conversion and timezone handling with non-empty results. - Initialize the local timezone only when the schema contains `TIMESTAMP_LTZ` columns. - Extend batch and streaming tests to compare empty and non-empty result dtypes, including timestamp precisions 0/3/6/9 and UTC/Asia/Shanghai timezones. ## Verifying this change - Confirmed that the regression tests fail before the fix and pass afterward. - Passed all eight targeted cases: `test_empty_to_pandas`, `test_empty_to_pandas_with_timestamps`, `test_to_pandas`, and `test_to_pandas_for_retract_table` in both `BatchPandasConversionTests` and `StreamPandasConversionTests`. - Tests ran against the changed Python source using Python 3.12.7, pandas 2.2.3, PyArrow 16.1.0, Java 17, and an existing local Flink 2.3-SNAPSHOT Java build. Re-ran the eight cases after rebasing onto the latest master. - Flake8 and git diff checks passed. - Full `./mvnw clean verify` was attempted but stopped at the root Apache RAT check on 11 pre-existing untracked local research files and Python packaging artifacts. None of those files is included in this PR; full reactor verification remains pending. ## Does this pull request potentially affect one of the following parts: - Dependencies: no. - Public API: yes, corrects the result dtypes of `Table.to_pandas()`; no signature changes. - Serializers: no serialization format changes. - Runtime per-record code paths: no. - Deployment or recovery: no. - S3 file system connector: no. ## Documentation - Does this pull request introduce a new feature? No; this is a bug fix. - If yes, how is the feature documented? Not applicable. - Suggested release note: PyFlink `Table.to_pandas()` now preserves schema-derived column dtypes for empty results, including timestamp timezone information. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes Generated-by: Codex (GPT-6) -- 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]
