Repository navigation
Make hive partition strategy a default under compatibility setting - #86746
Conversation
|
Workflow [PR], commit [eeee746] Summary: ✅ AI ReviewSummaryThis PR makes Final Verdict
|
jkartseva
left a comment
There was a problem hiding this comment.
03363_hive_style_partition needs to be aligned with the new default, otherwise looks good.
|
Dear @jkartseva, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
|
@kssenii, could you also please check these data lake tests? |
|
Dear @jkartseva, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
…mall-changes # Conflicts: # docs/en/sql-reference/table-functions/s3.md # src/Core/Settings.h # src/Core/SettingsEnums.cpp # src/Core/SettingsEnums.h
|
This was fixed by #105146. Let's update the branch. |
The new `file_like_engine_default_partition_strategy` default of `hive` was being applied even to data lake engines (`Iceberg`, `DeltaLake`, etc.), which manage partitioning themselves and rejected an explicit `partition_strategy` argument. Applying the default `hive` strategy caused `CREATE TABLE` for `IcebergLocal` with a `PARTITION BY` clause to fail validation, breaking inserts referenced by tests such as `04201_iceberg_manifest_per_file_stats` and `04061_iceberg_update_partition_key_empty_block`. Skip the default selection when `isDataLakeConfiguration` is true so data lakes continue to use their own partitioning path. CI report: #86746 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Two issues with `file_like_engine_default_partition_strategy`:
1. With `wildcard` and a path missing the `{_partition_id}` placeholder,
`partition_strategy_type` stayed at `NONE`, so `PARTITION BY` was
silently ignored instead of raising `BAD_ARGUMENTS`. Now set the
strategy unconditionally and let `PartitionStrategyFactory::get`
enforce the placeholder check. This also fixes the failing
`test_file_pruning_with_hive_style_partitioning` integration test.
2. With `hive`, `partition_columns_in_data_file` was left at the
parse-time default `true` (computed when the strategy was still
`NONE`), so implicit `hive` behaved differently from explicit
`partition_strategy='hive'` (which defaults it to `false`). Track
whether the user provided `partition_columns_in_data_file` and
recompute the default after the effective strategy is known.
Addresses unresolved AI-reviewer threads on PR #86746.
The default `partition_strategy` for `S3` / `AzureBlobStorage` table engines and the `s3` table function is now setting-driven via `file_like_engine_default_partition_strategy`: `wildcard` only under `compatibility` settings older than `26.5`, `hive` otherwise. The "(default)" marker under the `Partition Strategy` sections still hardcoded `wildcard` as the default, which contradicts the parameter table just above. Spell out the setting-based default instead. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ages Thread 5 and 6 on PR #86746 — the `S3` engine page (`docs/en/engines/table-engines/integrations/s3.md`) and the `azureBlobStorage` table-function page (`docs/en/sql-reference/table-functions/azureBlobStorage.md`) still described `WILDCARD` as the partition-strategy default, contradicting the `s3` table-function and `AzureBlobStorage` engine docs that were already updated in 69fe2af. Spell out the same setting-driven phrasing in both pages: defaults to the `file_like_engine_default_partition_strategy` setting (`WILDCARD` under `compatibility` settings older than `26.5`, `HIVE` otherwise). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Thread 7 on PR #86746 — `test_file_pruning_with_hive_style_partitioning` only verified the explicit `file_like_engine_default_partition_strategy` override; the `SettingsChangesHistory` wiring (`wildcard` for `compatibility` older than `26.5`, `hive` from `26.5` onwards) was not covered. Add two focused assertions: the same `CREATE TABLE ... PARTITION BY` without `{_partition_id}` must raise the `wildcard` error under `compatibility = '26.4'`, and must succeed under `compatibility = '26.5'`. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
After picking up master, the `02995` baseline is the `26.5.1` release which does not include this newly-added setting, and the test filter for `system.settings_changes` requires version > 26.5. Move the registration to the 26.6 block so the upgrade-detection query accepts the new name. CI report: https://s3.amazonaws.com/clickhouse-test-reports/PRs/86746/16f89ebfb974bf71b94cd595d892ecb234ee9ad4/fast_test/job.log
Previously `initPartitionStrategy` returned early as soon as it saw `partition_strategy_type == NONE && !partition_by`, which bypassed `PartitionStrategyFactory::get` and its `BAD_ARGUMENTS` guard for the inconsistent `partition_columns_in_data_file = 0` + implicit `none` strategy combination. Move the `partition_by` check into the outer condition so the default-strategy mapping is skipped but the factory call (and its consistency checks) still runs. Addresses AI Review thread `PRRT_kwDOA5dJV86EVRQS` on `StorageObjectStorageConfiguration.cpp:192`.
`ff135725524` moved the `SettingsChangesHistory` entry for `file_like_engine_default_partition_strategy` from `26.5` to `26.6`, but the docs and `test_file_pruning_with_hive_style_partitioning` were not updated to match. As a result, the test's `compatibility = '26.5'` case still resolves the setting to `wildcard` (since `applyCompatibilitySetting` reverts entries from versions strictly newer than the requested value), and the `CREATE TABLE ... PARTITION BY (b, c)` statement raises `Partition strategy wildcard can not be used without a '_partition_id' wildcard` instead of succeeding — the failure mode reported across all seven `Integration tests` shards on the PR run. Bump the boundary in the docs and the test to `26.6` so the wildcard / hive split matches where the change is actually registered. Caught by the unresolved review thread from `clickhouse-gh` on `f0975cfab95`. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
LLVM Coverage Report
Changed lines: 85.94% (55/64) | lost baseline coverage: 4 line(s) · Uncovered code |
|
Hi there, Checked on head: https://fiddle.clickhouse.com/a0ca16c2-d2f2-47bb-bd1c-824c3519b0f7 I assume that with With explicit partition strategy the error is visible though: Error message: cc: @clickgapai @groeneai |
|
Hi @alexbakharew, Short answer: it does not fail because the It is not a compatibility-mapping problem. The Mechanism:
Your explicit case fails because So this is working as designed: a path that literally contains If you think the implicit-default path should instead resolve to hive and then reject the placeholder (to match the explicit case), that is a design call for the PR author rather than a defect in the current code. Reproduced locally on 26.6.1.1. (session cron:clickhouse-worker-slot-28:20260610-184200) |
After ClickHouse#107437, a CREATE statement with a `{_partition_id}` placeholder in the path and no explicit `partition_strategy` was rejected with `BAD_ARGUMENTS` whenever the effective `file_like_engine_default_partition_strategy` default was `hive` (the default since 26.6). This broke pre-26.6 DDL and DDL generators that rely on the implicit wildcard strategy. A `{_partition_id}` placeholder is valid only under the `wildcard` strategy, so when no explicit strategy is given the path alone determines the only strategy that can work. `initPartitionStrategy` now infers `wildcard` from the path shape on CREATE, the same way it already does on ATTACH / server startup / RESTORE. The default setting only applies to paths without the placeholder, and an explicit `partition_strategy = 'hive'` still rejects such paths. Related: ClickHouse#106465 Related: ClickHouse#86746
After ClickHouse#107437, a CREATE statement with a `{_partition_id}` placeholder in the path and no explicit `partition_strategy` was rejected with `BAD_ARGUMENTS` whenever the effective `file_like_engine_default_partition_strategy` default was `hive` (the default since 26.6). This broke pre-26.6 DDL and DDL generators that rely on the implicit wildcard strategy. A `{_partition_id}` placeholder is valid only under the `wildcard` strategy, so when no explicit strategy is given the path alone determines the only strategy that can work. `initPartitionStrategy` now infers `wildcard` from the path shape on CREATE, the same way it already does on ATTACH / server startup / RESTORE. The default setting only applies to paths without the placeholder, and an explicit `partition_strategy = 'hive'` still rejects such paths. Related: ClickHouse#106465 Related: ClickHouse#86746
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Make hive partition strategy a default under compatibility setting
file_like_engine_default_partition_strategy.Documentation entry for user-facing changes
Note
Medium Risk
Changes default partitioned-write behavior for file-like engines based on
compatibility/new setting, which can alter generated object paths or flip errors for existingPARTITION BYdefinitions without explicitpartition_strategy. The change is scoped but affects widely used S3/AzureBlobStorage engines and is therefore moderately risky.Overview
Makes Hive-style partitioning the default for file-like engines (e.g.
S3,AzureBlobStorage) whenPARTITION BYis used and nopartition_strategyis provided, controlled by a new settingfile_like_engine_default_partition_strategyand flipped tohiveby default starting withcompatibility >= 26.5.Updates object-storage configuration parsing to track whether
partition_columns_in_data_filewas explicitly set and recompute its default after the effective strategy is chosen, and adds coverage to ensurecompatibilityand explicit setting overrides produce the expected create-table success/error behavior. Documentation is updated to describe the new defaulting rules and (in some places) normalize strategy names towildcard/hive.Reviewed by Cursor Bugbot for commit 16f89eb. Bugbot is set up for automated code reviews on this repo. Configure here.
Version info
26.6.1.270