Repository navigation
Conversation
|
Pre-PR validation gate (session a) Deterministic repro? Yes. b) Root cause explained? Yes. Iceberg's write path ( c) Fix matches root cause? Yes. Reject any explicit non-default d) Test intent / new tests added? Yes, new test e) Both directions demonstrated? Yes. Before fix: bug reproduced with both positional ( f) Fix is general, not a narrow patch? Yes. The check sits in |
|
cc @PedroTadim @alesapin @scanhex12 @Michicosun could you review? This implements the CREATE-TIME rejection for the silent LZMA/data-lake corruption from #105644. It also covers DeltaLake/Hudi/Paimon (where the outer codec is applied on write but produces files external engines can't read). |
|
Workflow [PR], commit [2f5dfa2] Summary: ❌
AI ReviewSummaryReviewed #105667 at Findings
Tests
Final VerdictStatus: Move validation before the remote catalog commit (or make creation transactional) and add the focused regression test above. |
The validation check is case-insensitive (it lowercases the input before comparing to "auto"/"none"), but the validated value was not stored back into configuration_to_initialize.compression_method. Downstream callers of chooseCompressionMethod in IO/CompressionMethod.cpp compare the hint case-sensitively at the auto/none fallback path, so inputs like AUTO or None would pass this CREATE TIME check yet later throw "Unknown compression method 'AUTO'" from read/write paths (ReadBufferIterator, StorageObjectStorageSink, StorageObjectStorageSource). Assign compression_method_lower back after validation so the stored value is always one of: empty, "auto", "none". This keeps the user-facing acceptance case-insensitive while ensuring downstream paths see only the canonical lowercase form that chooseCompressionMethod handles. The stateless regression test 04274 is extended with two new cases that create data lake tables with `AUTO` and `None` and then run a query against them. Addresses inline review on ClickHouse#105667 from clickhouse-gh[bot] / @PedroTadim.
Per @alesapin's review on ClickHouse#105667: scope the `compression_method` rejection to fresh `CREATE` mode so a server upgrade does not lock users out of tables whose metadata already persists a non-default value. `StorageObjectStorageConfiguration::initialize` now takes a `LoadingStrictnessLevel mode` parameter. The validation only throws when `mode < LoadingStrictnessLevel::ATTACH`, matching the pattern used by sibling storages (`Utils.cpp:306`, `StorageKafkaUtils.cpp:278` etc.). The case canonicalization at the end of the block still runs unconditionally so existing tables that happened to persist `AUTO` / `None` benefit from the lowercase normalization on the read/write path too. The two register call sites that have a real `args.mode` (`registerStorageObjectStorage.cpp`, `registerQueueStorage.cpp`) now forward it. The other two call sites (`TableFunctionObjectStorage`, `DataLake` catalogs) keep the default `CREATE` and continue to reject explicitly-typed bad values exactly as before; the synthetic ASTs they build never carry a user-supplied `compression_method`, so the change is behavior-preserving for them. Regression test `04274_105644_lzma_compression_rejected_for_datalake.sh` extended with two `ATTACH` scenarios (`lzma`, `gzip`) using the deprecated `Ordinary` database engine so that the full-spec `ATTACH TABLE name (cols) ENGINE = ...` form is accepted. Each `grep -c` returns 0 with the gate in place; without the gate both return 1 (verified on a stripped binary).
|
Pre-PR validation gate (commit 85d4f10, session cron:clickhouse-ci-task-worker:20260528-153000) a) Deterministic repro? Yes. With the gate removed and the rest of the patch intact, b) Root cause explained? c) Fix matches root cause? Yes. The d) Test intent preserved? Yes. Tests 1-7 still exercise CREATE-time rejection and canonicalization. Two ATTACH scenarios ( e) Both directions demonstrated? Yes.
f) Fix is general? Yes. The pattern matches the sibling CREATE-time gates already used elsewhere in |
|
@alesapin addressed in 85d4f10: |
| /// Gate the rejection on `mode < ATTACH` so existing tables created before this | ||
| /// validation landed can still attach after upgrade. The canonicalization below | ||
| /// runs unconditionally so attached tables also benefit from the lowercase fix. | ||
| if (mode < LoadingStrictnessLevel::ATTACH |
There was a problem hiding this comment.
This gates on every ATTACH path, including full-definition user queries like the new test's ATTACH TABLE ... ENGINE = IcebergLocal(..., 'lzma').
That still lets a user persist a new data-lake table with a non-default compression_method, so the broken read/write behavior remains reachable by replacing CREATE with ATTACH. Existing metadata does need to keep loading after upgrade, but the skip should be limited to metadata-replay paths, for example FORCE_ATTACH/FORCE_RESTORE and short ATTACH after the stored definition has been loaded. Full-definition ATTACH and ATTACH ... FROM should continue to run the new validation.
There was a problem hiding this comment.
Valid concern. The current gate (mode < LoadingStrictnessLevel::ATTACH)
follows the explicit CHANGES_REQUESTED directive on this PR ("just check
that LoadingStrictnessLevel that it's less than ATTACH"), which the previous
fixup commit 85d4f10f6db3 implemented. That gate covers CREATE and
SECONDARY_CREATE.
The bot's observation is correct that a user-supplied full-definition
ATTACH TABLE ... ENGINE = IcebergLocal(..., 'lzma') reaches this code with
mode == ATTACH and would slip past the rejection - which is exactly what
the new regression test exercises (and relies on, so that pre-existing tables
with the bad metadata can still be attached after upgrade).
Tightening to mode < LoadingStrictnessLevel::FORCE_ATTACH (reject CREATE,
SECONDARY_CREATE, and ATTACH; allow FORCE_ATTACH/FORCE_RESTORE) would
close the user-supplied-ATTACH hole, but only works if all server-startup
metadata-replay paths arrive with FORCE_ATTACH (not plain ATTACH). Happy
to flip the boundary if that's the preferred behavior - I'd like to confirm
with the reviewer whose CHANGES_REQUESTED set the current < ATTACH value
before changing it, since the trade-off is "user can deliberately ATTACH a
broken table" vs "all metadata-replay paths must use FORCE_ATTACH".
There was a problem hiding this comment.
Yes, I would keep the validation on user-supplied full-definition ATTACH and skip only existing-metadata replay or restore. Server startup loads tables with FORCE_ATTACH from loadMetadata.cpp, and RESTORE TABLE is already distinguished by is_restore_from_backup, so the boundary can be tightened to !isLoadingFromExistingMetadata(mode) && !is_restore_from_backup (or equivalently mode < LoadingStrictnessLevel::FORCE_ATTACH && !is_restore_from_backup) instead of mode < LoadingStrictnessLevel::ATTACH.
That still preserves old metadata loading after upgrade, but closes ATTACH TABLE ... ENGINE = IcebergLocal(..., 'lzma') as a fresh-definition bypass.
There was a problem hiding this comment.
One correction to the concrete condition above: if short ATTACH TABLE t must also remain compatible for detached pre-upgrade metadata, mode alone is not enough because that path still uses LoadingStrictnessLevel::ATTACH after loading the stored query. In that case, please pass the ASTCreateQuery distinction through as well and skip only for args.query.attach_short_syntax, isLoadingFromExistingMetadata(args.mode), or args.is_restore_from_backup.
The path that should still be rejected is full-definition ATTACH TABLE ... ENGINE = ... / ATTACH ... FROM, where the user is supplying a fresh definition.
There was a problem hiding this comment.
Addressed in commit 1876ef1821c. Plumbed args.query.attach_short_syntax through StorageObjectStorageConfiguration::initialize (and the parallel registerQueueStorage site) and tightened the gate to:
if (!is_attach_short_syntax
&& !isLoadingFromExistingMetadata(mode)
&& !is_restore_from_backup
&& configuration_to_initialize.compression_method_user_provided)
{
throw ...;
}The new predicate skips only the metadata-replay paths: short ATTACH TABLE name, FORCE_ATTACH (server startup loading from metadata/), FORCE_RESTORE, and RESTORE TABLE. Full-definition ATTACH TABLE name FROM '<path>' (cols) ENGINE = IcebergLocal(..., 'lzma') is rejected because the user is supplying a fresh definition.
Test 04274 gained case 9b covering ATTACH TABLE ... FROM '<path>' (cols) ENGINE = ... ('lzma') (the plain ATTACH TABLE name (cols) ENGINE = ... form is rejected up-front by the Atomic database engine, so the test uses the FROM '<path>' form which reaches the storage factory). Cases 8 and 9 (short ATTACH replay of pre-fix metadata) still pass. FORCE_ATTACH was verified manually by injecting 'lzma' into a saved .sql metadata file and restarting the server: the table loads cleanly with no BAD_ARGUMENTS.
There was a problem hiding this comment.
Status update so this thread matches the shipped code: the tightened gate described above (commit 1876ef1821c, rejecting full-definition ATTACH) was later simplified away per the maintainer's explicit CHANGES_REQUESTED directive ("just check that LoadingStrictnessLevel that it's less than ATTACH"). The final gate is mode < LoadingStrictnessLevel::ATTACH plus the is_restore_from_backup guard, and the is_attach_short_syntax parameter was removed again. All ATTACH forms — including a user-supplied full-definition ATTACH TABLE ... ENGINE = ... — are deliberately exempt as a compatibility path; the code comment, test 9b, and the PR description state this explicitly rather than claiming the metadata was previously validated. Leaving the final call on that trade-off to the maintainers.
There was a problem hiding this comment.
🕵 Status update after bf0bf592d27: the gate moved from mode < LoadingStrictnessLevel::ATTACH to mode == LoadingStrictnessLevel::CREATE (to exempt SECONDARY_CREATE, see the sibling thread on the Replicated-database recovery path). This does not change the behaviour discussed here: every ATTACH form, including a user-supplied full-definition ATTACH TABLE ... ENGINE = ..., remains deliberately exempt as a compatibility path, per the maintainer's explicit CHANGES_REQUESTED directive to keep the gate simple. The code comment, the test comments, and the PR description all state this explicitly rather than claiming the metadata was previously validated. The final call on that trade-off is left to the maintainers.
Per clickhouse-gh[bot] review on PR ClickHouse#105667: the prior ATTACH tests only counted occurrences of the "not supported by data lake engines" rejection string with `grep -c`. If `ATTACH` ever failed for any other reason (engine init bug, metadata format change, syntax change), `grep -c` would still print 0 and the test would pass without ever observing the table. After each `ATTACH`, also assert `EXISTS TABLE ${ORD_DB}.t_attach_*` is `1`, proving the table was actually attached to the catalog. Local verification: 20/20 passes with the LoadingStrictnessLevel gate in place; the test FAILS on both old (grep=2) and new (EXISTS=0) checks when the gate is removed, so the new assertion catches the regression class the bot flagged.
|
Pre-PR validation gate for 006ab12: (a) Deterministic repro? Yes. With my new gate disabled (single line change locally, (b) Root cause explained? Yes. (c) Fix matches root cause? Yes. The plumbing follows the bot's suggestion verbatim: (d) Test intent preserved? / new tests added? Yes. The ATTACH section of 04274 (e) Both directions demonstrated? Yes.
(f) Fix is general, not a narrow patch? Yes.
CI run pending on commit |
|
Pre-PR validation gate for commit 3fee1c5 (session
|
Pre-PR validation gate (commit 8286990)(a) Deterministic repro: yes. With the new build, CREATE/ICEBERG/SELECT TABLE FUNCTION calls that include any explicit (b) Root cause / mechanism: the previous gate allow-listed (c) Fix matches root cause: yes. New (d) Test intent preserved / new tests added: the regression test (e) Both directions demonstrated: 5/5 stable passes with (f) Fix is general: applies to all four data lake formats ( Session id: cron:clickhouse-ci-task-worker:20260530-071500 |
Following review feedback on PR ClickHouse#105667, the public table-function docs under `docs/en/sql-reference/table-functions/` still advertised the `compression` / `compression_method` argument for the data lake table functions (`iceberg*`, `deltaLake*`, `hudi*`, `paimon*`). Since commit `82869907ac6f` the server rejects any explicit `compression_method` on data lake engines and table functions, so users following these docs would get `BAD_ARGUMENTS`. Remove the argument from the syntax samples in: - `iceberg.md`, `icebergCluster.md` - `deltalake.md`, `deltalakeCluster.md` - `hudi.md`, `hudiCluster.md` - `paimon.md`, `paimonCluster.md` and add the same explanatory paragraph used in the parallel integration engine docs pointing users at the format-specific server setting (for example `output_format_parquet_compression_method`). Also drop the `compression` row from the argument tables in `hudi.md` and `hudiCluster.md`. Bot review: ClickHouse#105667 (comment)
Pre-PR validation gate (commit 16bda58)(a) Deterministic repro: yes. Without the fix, (b) Root cause: commit (c) Fix matches root cause: yes. The same surgical edit as the prior cleanup — drop the rejected token from the syntax block and add the same explanatory paragraph pointing users at the format-specific server setting (for example (d) Test intent preserved? / new tests: docs-only change; no test logic touched. The existing regression test (e) Both directions demonstrated: without fix → 22 occurrences across the 8 files; with fix → 0 occurrences, and a single new explanatory paragraph in each file. Diff stat: 8 files changed, 40 insertions(+), 26 deletions(-). (f) Fix is general, not narrow: applied to all 8 data-lake table-function docs (iceberg, icebergCluster, deltalake, deltalakeCluster, hudi, hudiCluster, paimon, paimonCluster), matching the full scope of the server-side rejection. No PR-only narrow patch. Bot inline comment addressed: #105667 (comment) Session: |
Bot review on PR ClickHouse#105667 found a coverage gap in the data lake compression_method rejection introduced earlier in the PR. The named-collection path in S3StorageParsedArguments::fromNamedCollection already handled both compression_method and the historical compression alias via hasAny(). The key-value engine/table-function path in S3StorageParsedArguments::fromAST (and parseFromDisk in Utils.cpp) only looked up the canonical compression_method key. When a user passed compression='lzma' as a key-value argument (for example, IcebergS3('<url>', compression='lzma')), the lookup missed, compression_method_user_provided stayed false, and the rejection in StorageObjectStorageConfiguration::initialize was silently bypassed, leaving the PR contract broken. Add a fallback lookup at both sites: when getFromPositionOrKeyValue returns nullopt for 'compression_method', also check for the 'compression' alias in key_value_args. Mirrors the existing hasAny pattern used by fromNamedCollection. Test 04274 extended with three engine-form cases: alias (compression=...), canonical (compression_method=...), and positional + alias (e.g. ENGINE = IcebergS3('<url>', 'Parquet', compression='lzma')). The rejection fires at initialize() before any S3 client is constructed, so a syntactically valid unreachable URL is sufficient and the test does not need network access. Without this fix the CREATE TABLE silently falls through to Iceberg metadata loading and hangs trying to reach the unreachable URL (verified locally: 131+ seconds before kill). With the fix the rejection fires immediately and the test passes in 4.2 seconds.
|
Pre-PR validation gate for 84ad4ec (alias coverage fix):
|
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Before this PR the key-value `compression` argument of the `S3` parser was ignored: `S3StorageParsedArguments::fromAST` only looked up `compression_method`. Commit 3ab402d made it an alias of `compression_method` so that the data lake check rejects it, but that also activated the codec on every replay of an existing definition (the check exempts `ATTACH`), and for plain `S3`, `S3Queue` and `s3` table functions on every query. Measured on a server upgraded from master with tables created there: `IcebergS3(<url>, <key>, <secret>, 'Parquet', compression = 'lzma')` reads `3 6` on master and fails with `LZMA_STREAM_DECODER_FAILED` on the PR head, and `S3(<url>, <key>, <secret>, 'CSV', compression = 'gzip')` reads `2 9` on master and fails with `CANNOT_DECOMPRESS`. With this change both read as on master, before and after a restart, and a fresh data lake definition carrying the argument is still rejected. The argument is now kept in `ignored_compression_argument`, which only the data lake check reads, also when `compression_method` is given next to it. The alias added to `parseFromDisk` by the same commit is removed: its key-value arguments also occupy positional slots, so any `compression = ...` there fails the literal check of another argument first (measured on all six engine shapes and three table-function shapes), and the branch was never reached. 04274 gets a replay case that reads rows back through a full-definition `ATTACH` and a plain `s3` read with the argument (both fail on the PR head), and a case with both arguments. Addresses ClickHouse#105667 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - f3e36a6Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:clickhouse-maint-slot-13:20261021-163500 |
Data lake engines and table functions take the compression of their data files from the table metadata, so an explicit `compression_method` (or key-value `compression`) argument is rejected, except `auto`. A `format` the engine cannot store its data files in is rejected too. Existing tables keep loading on `ATTACH`, `RESTORE` and secondary `CREATE`. Closes ClickHouse#105644 ClickHouse#105667 Co-authored-by: Alexey Milovidov <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
c2f4197 to
c0155c1
Compare
…ithout re-validating them
The data lake `compression_method` and `format` checks fire only for
`LoadingStrictnessLevel::CREATE`, so stored definitions of tables created
before the checks still load. Table functions always parsed their arguments
with `CREATE`, including when a persisted `CREATE TABLE t AS icebergLocal(...)`
definition is loaded at server startup (`DatabaseOnDisk::createTableFromAST`)
or by `ATTACH`/`RESTORE` (`InterpreterCreateQuery`). A table created on master
as `AS icebergLocal('<path>', 'Parquet', 'c0 Int32', 'none')` (or with
format `'CSV'`) read its rows there, and after an upgrade failed to load with
`Code: 36` on every restart.
`TableFunctionFactory::get` now takes the `mode` of the definition and hands
it to the table function before `parseArguments`; the object storage table
functions pass it to `StorageObjectStorageConfiguration::initialize`. A table
function in a query and a fresh `CREATE TABLE ... AS f(...)` still use
`CREATE` and are still rejected.
Test: 04274 case 23 replays such definitions (one per check) by a
full-definition `ATTACH` and by `DETACH DATABASE` / `ATTACH DATABASE`, which
takes the startup path.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Case 23 reads a table defined `AS icebergLocal(...)` back after reloading its database. With parallel replicas enabled in the default profile (the `ParallelReplicas` configuration), `DatabaseOnDisk::createTableFromAST` executes the table function as a read (`is_insert_query = false`), so `TableFunctionObjectStorage::executeImpl` builds a `StorageObjectStorageCluster`. Reading that table by name ships `FROM <table> AS __table1` to the replicas unchanged (`updateQueryToSendIfNeeded` only rewrites table functions), and they fail with `NOT_FOUND_COLUMN_IN_BLOCK`. A fresh `CREATE TABLE ... AS f(...)` executes it with `is_insert_query = true` and never gets the cluster variant. This is not caused by this change: on master the same read fails identically for `AS icebergLocal(path)` with no extra argument, after `DETACH`/`ATTACH DATABASE` and after a server restart. Neither a query-level nor a client-level `enable_parallel_replicas = 0` avoids it, because the storage type is fixed when the table is loaded, so the test is tagged `no-parallel-replicas`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - 24b413eEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:clickhouse-maint-slot-14:20261022-013600 |
CI finish ledger - e1b1d16Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The Session id: cron:our-pr-ci-monitor:20261022-070007 |
…hod-for-datalake-engines
Master now writes and reads `Vortex` data files in Iceberg tables (ClickHouse#112950): the format is recorded per data file in the manifest, like the three formats of the Iceberg specification. The per-engine `format` allowlist of this PR rejected it with `BAD_ARGUMENTS`, which broke the Vortex Iceberg tests 05331, 05332, 05339, 05395 and 05407 after the master merge. Add `Vortex` to the Iceberg set (all Iceberg engines, table functions and catalog paths share it). `DeltaLake`, `Paimon` and `Hudi` keep rejecting it: ClickHouse#112950 does not touch their readers or writers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - 2a7fd2eEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The Session id: cron:our-pr-ci-monitor:20261030-233003 |
Resolve the conflict in `04299_deltalake_local_path_traversal.sh`: master removed the legacy Delta Lake reader and the per-reader loop, so take the master version and keep this PR's switch from `RawBLOB` to `Parquet`.
|
🕵 Merged The previous CI failure ( The three open review threads already have replies and are left to a maintainer, because each one is a design question rather than a missing fix: full-definition |
# Conflicts: # src/Databases/DataLake/DatabaseDataLake.cpp # src/Databases/DataLake/DatabaseDataLake.h
Conflicts: `GlueCatalog.cpp` (master removed the schema cache member; keep this PR's `table_definition_mode`), and `test_writes_create_table_bugs.py` (moved by master to stateless test `05721`; this PR's switch from `CSV` to `Parquet` is applied there).
Test `05632_iceberg_insert_text_format_file_cut`, added on master, created an `IcebergLocal` table with the `JSONEachRow` format, which `CREATE` now rejects. The race it covers is still reachable for tables defined before that check, which load through `ATTACH`. The test now creates the Iceberg metadata with `Parquet`, drops the table keeping its files, and attaches a full definition (`ATTACH TABLE ... UUID`) with `JSONEachRow`. It is a `.sh` test because the `UUID` of `ATTACH` must be a literal, and it also checks that every data file is in the text format. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Merged
There was also a semantic conflict. The three open review threads are design trade-offs that are still left for a maintainer to decide, as explained in their replies: the |
| context_copy, | ||
| /* with_table_structure */ false, | ||
| /* table_id */ nullptr, | ||
| table_definition_mode); |
There was a problem hiding this comment.
[Major] Validate inherited arguments before creating a table in the catalog
A fresh REST database defined with DataLakeCatalog(url, key, secret, 'Parquet', 'none') is accepted, but CREATE TABLE d.`ns.t` (x String) ENGINE = IcebergS3 reaches this validation after committing the table remotely: maybeCreateTableInExternalCatalog calls catalog->createTableAtDefaultLocation at DatabaseDataLake.cpp:1283, then tryGetTableImpl at line 1286. This initialization rejects none, so the statement reports BAD_ARGUMENTS while the catalog already contains the new table. RestCatalog sends stage-create = false, and neither caller rolls the creation back. A retry finds an existing table, and DROP TABLE through the same database hits the same validation.
Please validate the inherited format/compression arguments before the external create, or make that operation transactional. Extend the existing REST catalog integration coverage to assert that a rejected CREATE TABLE leaves no table in the external catalog.
The test attaches a full table definition, so the server logs "ATTACH TABLE query with full table definition is not recommended" as a warning. The client receives server logs at `warning` level by default and prints them to stderr, which fails the test in every stateless job (seen in `Stateless tests (amd_asan_ubsan, db disk, distributed plan, targeted)`; a run with `clickhouse local` does not show it). Receive only errors, as the full-definition `ATTACH` cases of `04274` do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@groeneai, fix conflicts. |
Conflicts with the replayed-definition flag of ClickHouse#115581 and the `DataLakeCatalog` replay rules of ClickHouse#132097: - `TableFunctionFactory::get` and `getRequiredAccessOfTableFunction` take both `is_replayed_definition` and the loading `mode`; the data lake argument check of a table function keys on the mode, like the engine path, so a stored `CREATE TABLE ... AS <data lake function>` still loads wherever master now parses the function for the access check. - `DatabaseDataLake::table_definition_mode` treats a replay marked with `isRecoveryFromStoredMetadata` as `ATTACH`, as ClickHouse#132097 does for the other fresh-`CREATE` validations. - Glue catalog: `SecretString` engine definition from master, plus the mode. - Docs and `.syntax` strings: master's workload identity forms of `deltaLakeAzure`, `deltaLakeAzureCluster` and `DeltaLakeAzure` without the `compression` slot. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged master in 824a517, the PR is mergeable again. Two conflicts needed more than picking a side:
The data lake tests of this PR pass locally, and a scan of the 58 data lake tests changed on master since the last merge finds no argument this PR rejects. |
The merge of master in 824a517 kept master's `#include <algorithm>` and the PR's own copy below `<fmt/ranges.h>`, which fails `Build (arm_tidy)` with readability-duplicate-include. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes: #105644
Data lake engines (
Iceberg,DeltaLake,Hudi,Paimon) accept acompression_methodargument, but the on-disk file format (Parquet/ORC/Avro) already has its own internal codec. ForIcebergLocal/IcebergS3/etc. the write path goes throughMultipleFileWriter::startNewFile, which never wraps the buffer withwrapWriteBufferWithCompressionMethod, so the user'scompression='lzma'is silently dropped and the on-disk file is rawParquet. The read path inStorageObjectStorageSourcestill callschooseCompressionMethod(filename, configuration->compression_method), which with hint'lzma'ignores the.parquetextension and returnsCompressionMethod::Xz, then wraps the read buffer withLZMAInflatingReadBuffer. The decoder sees raw Parquet bytes and fails withLZMA_FORMAT_ERROR.For
DeltaLake/Hudi/Paimonthe write path usesStorageObjectStorageSink, which does honor the outer codec, so the file round-trips inside ClickHouse, but the produced LZMA-wrapped Parquet is unreadable by external engines (Spark, Trino, etc.). Same class of silent corruption from an interoperability point of view.This change rejects explicit
compression_method/compressionvalues other thanauto(case-insensitive) or an empty string at fresh-definition time for any data lake configuration (Iceberg,DeltaLake,Hudi,Paimon), with a clear error pointing at the format-specific codec setting. Users who need to control file compression should use the format-specific settings such asoutput_format_parquet_compression_method. The default value pass-through is unchanged: the rejection only fires when the user explicitly supplied the argument, so unmodifiedCREATE TABLEstatements continue to work.The rejection is gated on
LoadingStrictnessLevel == CREATE, so it fires only for a fresh definition: aCREATE TABLE(alsoCREATE TABLE ... AS f(...)with a data lake table function), or a data lake table function in a query. Every other mode replays a definition that was already accepted when the table was created, and is deliberately exempt as a compatibility path so pre-fix tables still load after an upgrade: everyATTACHform (short-syntaxATTACH TABLE name, full-definitionATTACH TABLE name FROM '<path>' (cols) ENGINE = ..., and the server-startup replay pathsFORCE_ATTACH/FORCE_RESTORE), andSECONDARY_CREATE, which covers bothRESTORE TABLEand the replay of the storedCREATE TABLEtext byDatabaseReplicated::recoverLostReplica(so aReplicateddatabase created before this validation landed still recovers on an upgraded replica). Note that this includes a user-supplied full-definitionATTACH, which can therefore still persist a definition carryingcompression_method; per review, the gate is intentionally kept simple rather than special-casing theATTACHshapes. A freshCREATEin aReplicateddatabase is still rejected, because the initiator runs it as an initial query and therefore withmode == CREATE.The tables of a catalog-backed database (
DataLakeCatalog, including the Glue catalog) derive their engine arguments verbatim from the positional arguments of theCREATE DATABASEquery, so acompression_methodor unsupportedformatthere follows the same rule. The database passesCREATEto the per-table validation when the user supplies the database definition -CREATE DATABASEor a full-definitionATTACH DATABASE ... ENGINE = ...(the definition is validated lazily, on first use, like the rest of this engine's configuration) - andATTACHwhen its definition is replayed - server startup, a shortATTACH DATABASE db, orRESTORE DATABASE- so a database created before this validation landed keeps working after an upgrade. Covered by the new integration testtest_database_iceberg/test.py::test_compression_argument_in_database_definition.Reproducer (no longer accepted after this patch):
This change also rejects an explicit
formatthat the lake cannot store its data files in, reported on this pull request while fuzzing data lakes. It is the same failure mode as thecompression_methodone:INSERT INTO TABLE FUNCTION deltaLakeLocal(..., format = 'RowBinary')is accepted, writes the file, and commits it into the Delta log as an ordinary data file, after which every reader - ClickHouse included - parses it asParquet, because the Delta log records no per-file format. The table is corrupted for good. The read side is worse still: opening an untouched, all-ParquetDelta table withformat = 'RowBinary'returns garbage rows and no error at all.The accepted set is per engine, exposed through the new
getSupportedDataLakeFormats, because the engines genuinely differ:DeltaLakeParquetIcebergParquet,ORC,Avro,VortexVortex.PaimonParquet,ORC,AvroHudiParquet,ORCformatselects the extension of the base files that are listed, and Hudi base files are columnar.The check reuses the exemptions of the
compression_methodgate, so a table persisted before this change still attaches, and it never fires for theautodefault, which is resolved to the lake's own default afterwards.Reproducer (no longer accepted after this patch):
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Reject explicit
compression_method/compressionvalues other thanauto(case-insensitive) or an empty string for data lake engines (Iceberg,DeltaLake,Hudi,Paimon) at fresh-definition time. The outer compression codec was silently dropped on the Iceberg write path while still applied on read, producing files the engine could not read back. For other data lake formats it produced non-standard files unreadable by external engines. Users who need to control file compression should use the format-specific settings such asoutput_format_parquet_compression_method. Also reject an explicitformatthat the lake cannot store its data files in (ParquetforDeltaLake;Parquet,ORC,AvroorVortexforIceberg;Parquet,ORCorAvroforPaimon;ParquetorORCforHudi), which corrupted the table on write and silently returned garbage rows on read. Pre-existing tables persisted before this validation landed still load viaATTACH, server startup,RESTORE, andReplicated-database replica recovery.Documentation entry for user-facing changes
Workflow [PR]
Sync PR [sync-upstream/pr/105667]