Repository navigation
Allow repeated values in Arrow dictionaries - #125677
alexey-milovidov merged 3 commits into
Conversation
|
Workflow [PR], commit [629c7ee] Summary: ✅
AI ReviewSummaryPR #125677 allows repeated values, including repeated nulls, in Missing context / blind spots
Final Verdict✅ Approve. No code changes requested; current-head CI should complete before merge. |
`02904_arrow_dictionary_indexes` still expected `INCORRECT_DATA` for a dictionary with repeated values, which is now read. `04497_native_arrow_ipc_delta_dictionary_duplicate` compared rows of two record batches in file order, but `clickhouse-local` with several threads may output the chunks in a different order; read them with `max_threads = 1`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125677&sha=8667522018aded3158f565a03a796afb148df782&name_0=PR PR: ClickHouse#125677 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 14 s compile time in total, 7 of them have a recent master baseline. |
…e `05361_arrow_testing_corpus` Master now checks negative value counts and sizes of Parquet column chunks in `ReadManager` only for the columns whose data is read (see `05331_parquet_v3_corrupt_column_chunk_sizes`). The eager check in `Reader::prefilterAndInitRowGroups` added by this PR made that test fail, because it rejected a file whose corrupted column is not read with `PREWHERE`. Remove it in favor of the check from master. After #125677, Arrow files with dictionary-encoded columns from the corpus are read successfully, so update the reference of `05361_arrow_testing_corpus`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125134&sha=6f7f9f758f5282a512d993cb36abf144842c62d4&name_0=PR PR: #125134 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the conflicts of the cherry-pick of #132416 to 26.9. The fix applies in full; the differences from the original diff come only from master-only neighbours that 26.9 does not have: - `ArrowIPCBlockInputFormat.cpp`: 26.9 still checks that dictionary values are unique after registering them (master dropped the check in #125677). Keep the check and look the values up by the dictionary use, as the registry is now keyed by it. - `RecordBatchDecoder.cpp`: 26.9 has no `TypeKind::RunEndEncoded` case in `collectDictionaryUses` (run-end encoding, #126207, is master-only), so there is no call to pass `below_union` to there. The struct case keeps the 26.9 helpers `tupleElementHint` / `childPath` (master renamed them in #125674) and passes `below_union` as the original change does. - `RecordBatchDecoder.cpp`: include `base/scope_guard.h` for the two new `SCOPE_EXIT` uses. On master the include came with the big-endian reader (#126562); 26.9 does not include it, directly or transitively. - `RecordBatchDecoder.h`: no `[[nodiscard]]` on the changed declarations, as on the rest of the 26.9 file (master added them in #126158). Co-authored-by: yakov <[email protected]>
Closes: #125139
The Arrow format doesn't require the values of a dictionary to be unique, but the native Arrow IPC reader rejected such files with
Arrow dictionary contains duplicate values(for examplegenerated_dictionaryfrom theapache/arrow-testingintegration corpus).The check isn't needed by the reader:
RecordBatchDecoder::decodeDictionarybuilds aLowCardinalitywithinsertRangeFromDictionaryEncodedColumn, which inserts the values into the column's own unique dictionary and remaps the indexes, and the non-LowCardinalitypath gathers the values withIColumn::index. Both resolve repeated values (including repeated nulls) correctly. So the check is removed.Tests:
05395_arrow_dictionary_duplicate_values: a pyarrow-written file and stream with repeated string values and repeated nulls (top-levelLowCardinality(Nullable(String))), repeated numbers (LowCardinality(Nullable(Int64))), and repeated values in a dictionary nested in a list (Array(Nullable(String))).04497_native_arrow_ipc_delta_dictionary_duplicateexpected a delta dictionary that repeats a base value to be rejected; it now checks that the column is read correctly.04344_native_arrow_ipc_pruned_dictionaryused a dictionary with a duplicate value as an example of a dictionary that fails to decode, to test that unrequested dictionaries are skipped. It now corrupts the dictionary's last string offset instead, so it still tests the same thing.The Apache Arrow library based reader (
ArrowColumnToCHColumn, used by Arrow Flight and Delta Lake) still rejects such dictionaries, because it shares the dictionary column with theLowCardinalityresult as is. That can be changed separately if needed.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The
ArrowandArrowStreaminput formats can read dictionary-encoded columns whose dictionary has repeated values, which the Arrow format allows.Workflow [PR]
Sync PR [sync-upstream/pr/125677]
Version info
26.10.1.2451-master(included in26.10and later)