Repository navigation
Conversation
|
Workflow [PR], commit [289b40a] Summary: ❌
AI ReviewSummaryThis PR introduces Findings❌ Blockers
Tests
Final Verdict
|
| ) | ||
|
|
||
|
|
||
| def create_clickhouse_iceberg_database( |
There was a problem hiding this comment.
Can we add the same test for glue?
|
|
||
|
|
||
| std::optional<TransformAndArgument> parseTransformAndArgument(const String & transform_name_src) | ||
| std::optional<TransformAndArgument> parseTransformAndArgument(const String & transform_name_src, const String & time_zone) |
There was a problem hiding this comment.
Let's make this argument optional everywhere
|
Dear @scanhex12, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
…tests. Run the server in Asia/Istanbul with the setting unset so pruning follows the session timezone, proving empty is not hardwired to UTC. Co-authored-by: Cursor <[email protected]>
Insert day-partitioned rows across a UTC boundary with session TZ Asia/Istanbul and assert partition file counts for UTC vs empty setting. Co-authored-by: Cursor <[email protected]>
| )", BETA, enable_nullable_tuple_type) \ | ||
| DECLARE(UInt64, archive_adaptive_buffer_max_size_bytes, 8 * DBMS_DEFAULT_BUFFER_SIZE, R"( | ||
| Limits the maximum size of the adaptive buffer used when writing to archive files (for example, tar archives)", 0) \ | ||
| DECLARE(Timezone, iceberg_partition_timezone, "", R"( |
There was a problem hiding this comment.
iceberg_partition_timezone describes a property of the Iceberg table, but this wires it up as a query-global Settings entry and every execution path then reads it from Context (ManifestFileIterator.cpp:314, ChunkPartitioner.cpp:59, Utils.cpp:1473).
That creates a correctness hole:
- one query cannot read two Iceberg tables that were partitioned in different time zones, because both tables will be pruned with the same timezone;
INSERT,ALTER ... UPDATE/DELETE, andOPTIMIZEonly stay consistent if every caller remembers to re-set the same session setting, otherwise the same table can be rewritten under a different partition mapping.
Since the mismatched-timezone case already drops rows during pruning, this needs to be table-scoped state rather than a per-query knob. I think this should live in DataLakeStorageSettings / the table configuration (with a query override only as an escape hatch), so each Iceberg table carries its own partition-timezone contract.
There was a problem hiding this comment.
Thanks for the review. I agree that query-global scoping has limitations, but I don’t think this should block the PR.
iceberg_partition_timezone follows the same pattern as other Iceberg query settings (use_iceberg_partition_pruning, iceberg_snapshot_id, iceberg_timestamp_ms, etc.). The motivating case is reading externally written Iceberg tables (often via DataLakeCatalog) whose temporal partitions use UTC, while the ClickHouse server/session timezone is not UTC. Iceberg’s own temporal transforms are defined on UTC boundaries, so the common fix is a profile/session default of iceberg_partition_timezone='UTC', not a different timezone per table.
For that catalog use case, a table-only DataLakeStorageSettings value is awkward: catalog tables are not individually created with engine SETTINGS, and a single session default of UTC is the practical configuration.
Empty default preserves historical behavior (use server/session timezone) for both reads and writes. The write-path footgun when the setting is omitted is therefore the same as today; the setting is an opt-in override, not a change to the default write contract.
| int direction = field->getValue<String>(f_direction) == "asc" ? 1 : -1; | ||
| auto iceberg_transform_name = field->getValue<String>(f_transform); | ||
| auto clickhouse_transform_name = parseTransformAndArgument(iceberg_transform_name); | ||
| auto clickhouse_transform_name = parseTransformAndArgument(iceberg_transform_name, |
There was a problem hiding this comment.
getSortingKeyDescriptionFromMetadata now routes temporal sort transforms through iceberg_partition_timezone, but the added coverage still never exercises that carrier.
The new external-table tests create a DayTransform sort order and only do plain reads / partition-pruning checks, so they would still pass if this line silently kept using the session timezone. The new write-path test does not cover it either, because it creates ClickHouse tables without ORDER BY, so sort_description stays empty there.
Please add one focused regression for the changed sort-order path, for example by extending test_read_in_order_with_pyiceberg.py with a table sorted by DayTransform(timestamp) under server Asia/Istanbul plus iceberg_partition_timezone='UTC', and asserting optimize_read_in_order=1 (or ClickHouse write sorting) still behaves according to the UTC transform.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 69/90 (76.67%) · Uncovered code |
…ioning Resolve the conflict with the move of the settings changes history into the setting declarations (ee6b44f): the history records this PR added to `SettingsChangesHistory.cpp` now live as trailing arguments of the `DECLARE` of each setting. - retargeted PR record [email protected] to 26.10 (settings-history check rule) - semantic merge fixes in non-conflicting files: src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFilesPruning.cpp Also resolved conflicts in: - `src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFileIterator.cpp` - `src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.cpp` `buildPartitionKeyFromSpec`, which master moved into `ManifestFilesPruning.cpp`, passes `iceberg_partition_timezone` too, so partition pruning honors the setting. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
|
||
|
|
||
| std::optional<TransformAndArgument> parseTransformAndArgument(const String & transform_name_src) | ||
| std::optional<TransformAndArgument> parseTransformAndArgument(const String & transform_name_src, std::optional<String> time_zone) |
There was a problem hiding this comment.
iceberg_partition_timezone now changes how temporal Iceberg transforms are interpreted on the read and write paths, but ALTER TABLE ... DROP PARTITION is still on the old contract.
AlterDropPartitionExecutor::resolvePartitionTypes builds the partition types through ChunkPartitioner (AlterDropPartitionExecutor.cpp:206), so a day(ts) spec under iceberg_partition_timezone='UTC' expects UTC partition values. But parsePartitionTuple still just evaluateConstantExpression on the user expression (AlterDropPartitionExecutor.cpp:164). With session_timezone='Asia/Istanbul', DROP PARTITION tuple(toRelativeDayNum(toDateTime('2024-01-02 01:00:00'))) folds to the Istanbul day even though the manifest keys were written as UTC days, so we can target and delete the wrong partition.
Please route temporal DROP PARTITION expressions through the same transform mapping as reads/writes (or reject them when iceberg_partition_timezone is set) and add a focused regression for the UTC override case.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Setting
iceberg_partition_timezoneto set time zone by which partitioning of Iceberg tables was performedDocumentation entry for user-facing changes
When Iceberg table created with third-party tools, data are split on partitions with specific time zone, UTC in most cases.
But ClickHouse tries to make partition pruning based on server time zone, and when server time zone is not UTC, some data can be incorrectly pruned during select queries.
Example: Iceberg table is partitioned by days by column
time. It has value2025-12-31 22:00:00 UTC. and placed in partition20251231. ClickHouse has server time zoneUTC+3, in ClickHouse time zone this value is2026-01-01 01:00:00 UTC+3. If query has conditionSELECT ... WHERE time >= '2026-01-01 00:00:00', partition pruning makes decision that value can be only in partitions20260101and later, and prunes partition20251231with this value.This PR introduces new setting
iceberg_partition_timezone, which contains time zone used for partitions. This time zone can be different from server time zone, session time zone or column time zone.Default value is empty for backward compatibility. Empty value means 'use current time zone' as before PR.
Workflow [PR]
Sync PR [sync-upstream/pr/95659]