Repository navigation
Cherry pick #105584 to 26.3: Honor cast_string_to_date_time_mode for hive partition values - #105727
Merged
robot-ch-test-poll3 merged 11 commits intoMay 27, 2026
Merged
Conversation
Hive partition value extraction is conceptually a string-to-type cast, but the code in `HivePartitioningUtils` was building a fresh `FormatSettings` with only `allow_number_leading_zeros = true` and ignoring the user's settings. As a result, parsing of `DateTime` and `DateTime64` partition values defaulted to the strict `Basic` parser and rejected ISO 8601 timestamps with timezone suffixes such as `+0000`, `+00:00`, or `Z`. Setting either `cast_string_to_date_time_mode = 'best_effort'` or `date_time_input_format = 'best_effort'` had no effect. Thread `format_settings` and the context through `addPartitionColumnsToChunk`, and centralize the construction of hive-specific `FormatSettings` in a helper that overrides `date_time_input_format` with `cast_string_to_date_time_mode`. The setting defaults to `best_effort`, so by default Hive-partitioned data lakes with ISO 8601 timestamp keys (including Python `pandas` `isoformat` output and similar) now read without an exception. Fixes #105368. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The flaky check runs each query with a random `session_timezone` (e.g. `Mexico/BajaSur`). For the inferred-type case the column type is `DateTime` with no explicit timezone, so the displayed value depends on the session timezone and the reference would not match when the session timezone is shifted. Pin `session_timezone = 'UTC'` so the output is deterministic across configurations. See #105584 CI flaky-check failures on commit be09afa. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Address review comment #105584 (comment). The previous commit made `HivePartitioningUtils` honour `cast_string_to_date_time_mode` for schema-backed hive partition columns, but the same invariant was still broken for hive keys materialized as virtual columns. In `prepareReadingFromFormat`, missing schema columns are classified as `requested_virtual_columns`, and then `VirtualColumnUtils::addRequestedFileLikeStorageVirtualsToChunk` parsed them with a fresh `FormatSettings` that only set `allow_number_leading_zeros`. The path filter evaluation in `addPathAndFileToVirtualColumns` had the same problem. Expose `HivePartitioningUtils::buildHiveFormatSettings` as a public helper and route both `addRequestedFileLikeStorageVirtualsToChunk` and `getFilterByPathAndFileIndexes` through it, threading the storage's `format_settings` from all call sites so all hive partition value conversions honour `cast_string_to_date_time_mode` consistently. Extend `04259_hive_partitioning_datetime_timezones.sh` with two new cases covering the virtual-column path (schema declares only `id`) and a `WHERE` filter on the virtual column. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…rtualsToChunk` loop `buildHiveFormatSettings` was constructed once per matched hive virtual column, but the result is identical for every iteration and the `getFormatSettings(context)` fallback reads many settings. This matches the hoisting pattern already used by `addPartitionColumnsToChunk` in `HivePartitioningUtils.cpp` and `getFilterByPathAndFileIndexes` in `VirtualColumnUtils.cpp`, and addresses the Cursor Bugbot review on commit 1b969c5.
… test The PR description notes that prior to this fix, neither `cast_string_to_date_time_mode` nor `date_time_input_format` had any effect on hive partition value parsing. Test coverage existed for `cast_string_to_date_time_mode` but not for the `date_time_input_format` variant referenced in the description. Hive partition value extraction is conceptually a cast, so `cast_string_to_date_time_mode` is the authoritative setting and overrides `date_time_input_format` inside `buildHiveFormatSettings`. The new query exercises the setting referenced in the PR description; since `cast_string_to_date_time_mode` defaults to `best_effort`, the timezone-suffixed paths parse successfully. Addresses review feedback from @Ergus on PR #105584.
…time-tz Honor cast_string_to_date_time_mode for hive partition values
Member
|
Dear @alesapin, @Ergus, @alexey-milovidov, this cherry-pick PR has not been updated for 3d1h47m54s. Please resolve the conflicts to backport #105584, or close this PR if the backport is no longer needed. This PR will be automatically closed after 7 days of inactivity. |
Member
|
I solved the conflicts manually, however I saw some unexpected conflicts I would like to be sure are fixed before merging. Can we trigger the CI? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Original pull-request #105584
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job