Repository navigation
Puffin output format - #121982
Puffin output format#121982
Conversation
|
Workflow [PR], commit [0f6197b] Summary: ✅
AI ReviewSummaryAdds Findings
💡 Nits
Final Verdict |
cf79570 to
f868f29
Compare
# Conflicts: # src/Core/SettingsChangesHistory.cpp
|
Dear @alesapin, 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. |
|
Dear @asya-ch, 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. |
# Conflicts: # src/Formats/FormatFactory.cpp # tests/queries/0_stateless/02187_async_inserts_all_formats.python # tests/queries/0_stateless/03251_insert_sparse_all_formats.sh
… history Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s` in the `Puffin` output format Apache Iceberg always writes `-1`, `-1` and `[2147483645]` (the `_pos` metadata column id) into the blob metadata of deletion vectors, so the settings `output_format_puffin_snapshot_id`, `output_format_puffin_sequence_number` and `output_format_puffin_field_ids` are removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d `fields` in the `Puffin` output format" This reverts commit 0e10e18.
…BlockOutputFormat` to fix the style check https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121982&sha=e26d04cca08d7f856899f5e12b0e0cc2e8e3fe39&name_0=PR&name_1=Style%20check #121982 Co-Authored-By: Claude Opus 5.5 <[email protected]>
groeneai
left a comment
There was a problem hiding this comment.
I checked the writer against the Puffin spec with this PR's CI amd_binary build of 84177c5: the file magic, the length/magic/CRC envelope, the portable roaring layout with unsigned key order and the footer trailer all match it, and the CI integration test shows Iceberg reads the result. 100M positions take about 1 s to write, so nothing on performance. Two design points inline, both about the threads @ asya-ch opened.
Build profile diff (arm_release)Comparing Binary sizes
The official master build is compiled with Object file sizes
|
| Object file | Master | PR | Δ |
|---|---|---|---|
src/CMakeFiles/dbms.dir/Processors/Formats/Impl/Puffin/PuffinBlockInputFormat.cpp.o |
new | 716.38 KiB | +716.38 KiB |
src/CMakeFiles/dbms.dir/Processors/Formats/Impl/Puffin/PuffinThetaSketch.cpp.o |
new | 221.89 KiB | +221.89 KiB |
src/CMakeFiles/dbms.dir/Processors/Formats/Impl/Puffin/PuffinCommon.cpp.o |
new | 178.15 KiB | +178.15 KiB |
src/CMakeFiles/dbms.dir/Processors/Formats/Impl/Puffin/PuffinWriter.cpp.o |
new | 168.04 KiB | +168.04 KiB |
src/CMakeFiles/dbms.dir/Processors/Formats/Impl/Puffin/PuffinDeletionVector.cpp.o |
new | 124.54 KiB | +124.54 KiB |
src/CMakeFiles/dbms.dir/Processors/Formats/Impl/Puffin/PuffinBlobBuilder.cpp.o |
new | 123.54 KiB | +123.54 KiB |
src/CMakeFiles/dbms.dir/Processors/Formats/Impl/Puffin/PuffinBlockOutputFormat.cpp.o |
new | 92.46 KiB | +92.46 KiB |
src/CMakeFiles/dbms.dir/Processors/Formats/Impl/Puffin/PuffinReader.cpp.o |
new | 60.60 KiB | +60.60 KiB |
src/Functions/CMakeFiles/clickhouse_functions_obj.dir/FunctionsNumericIndexedVector.cpp.o |
18.10 MiB | 18.12 MiB | +17.41 KiB (+0.09%) |
712 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.
Compile time of recompiled translation units
813 translation units recompiled, 7836 s compile time in total, 805 of them have a recent master baseline.
Translation units without a recent master baseline:
src/Processors/Formats/Impl/Puffin/PuffinBlockInputFormat.cpp: 7.5 s
Address the review of the `Puffin` output format: - `PuffinWriter` writes the Puffin container independently of the blob type, with a dynamic list of blobs; `PuffinBlob` moved to `PuffinCommon.h` together with the `apache-datasketches-theta-v1` blob type. - `PuffinDeletionVector` serializes `deletion-vector-v1` blobs from `roaring::Roaring64Map` and fills their metadata the way Apache Iceberg does. - The output format takes the same `(referenced_data_file, deleted_rows)` columns as the input format and writes one blob per referenced data file, so Puffin files with several deletion vectors can be copied. - Remove the `output_format_puffin_referenced_data_file`, `output_format_puffin_snapshot_id`, `output_format_puffin_sequence_number` and `output_format_puffin_field_ids` settings: the data file is an input column and the rest are constants for deletion vectors. Related: #121982 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rows of a Puffin file with several blobs may come in any order, so the test failed in CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121982&sha=aaf34f04f4c868d66f500b5bf5ea2c8a80857aea&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20distributed%20plan%2C%20targeted%29 Related: #121982 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ormat With `output_format_puffin_blob_type = 'apache-datasketches-theta-v1'` every input column becomes one Theta sketch blob with the `ndv` property, the way Iceberg writes column statistics. Values are fed to the sketch in the Iceberg single-value serialization, `NULL`s and empty values are skipped, and the result goes through a `theta_union` like Iceberg's merge. Field ids, snapshot id and sequence number come from `output_format_puffin_field_ids`, `output_format_puffin_snapshot_id` and `output_format_puffin_sequence_number`. `PuffinMetadata` now accepts Theta sketch blobs (the `ndv` property is required), and `Puffin` skips them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`PuffinBlockOutputFormat` now only forwards chunks to a builder chosen by `createPuffinBlobBuilder` from `output_format_puffin_blob_type`. `PuffinDeletionVectorBuilder` and `PuffinThetaSketchBuilder` own header validation, accumulation, serialization and blob metadata of their blob type. No change in behavior or in the written files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Builder headers now only declare `createPuffinDeletionVectorBuilder` and `createPuffinThetaSketchBuilder`; the classes live in the source files. This keeps CRoaring and DataSketches headers apart: the `IS_BIG_ENDIAN` macro of CRoaring broke an enum in `theta_sketch.hpp`. Also add the missing `Columns/ColumnsDateTime.h` include. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Java DataSketches stores the sampling probability `p = 1.0` in bytes 12-15 of a compact sketch, while the C++ library leaves them zero. Write it the Java way, so that in exact mode the blobs are byte-identical to the ones written by Iceberg's `compute_table_stats` in Spark. Checked locally against Iceberg 1.10 for `boolean`, `int`, `long`, `float`, `double`, `date`, `timestamp`, `string`, `decimal` and `binary` columns: all exact-mode sketches are byte-identical, and estimation-mode `ndv` differs by at most 0.02% (Iceberg builds Alpha sketches, the C++ library has only QuickSelect ones). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tics writes Prepares the ground for #131249, which writes NDV statistics on Iceberg commits: - `PuffinColumnThetaSketch` is the Theta sketch of one column, with the hashing of that PR: values are cast to a type whose `getDataAt` bytes are the Iceberg single-value serialization (decimals and `UUID` are encoded explicitly) and hashed with the new `IColumn::computeMurmurHash3Into` straight into the hash table of an `update_theta_sketch`. The result goes through a `theta_union` and gets `p = 1.0`, so it stays byte-identical to Iceberg's sketches. The `Puffin` output format and Iceberg statistics writes can both build on it. - `PuffinBlob::toJSON` and `PuffinReader` (footer, blobs on demand, `zstd` and `lz4` blobs) from that PR. - Blobs of unknown types are listed by `PuffinMetadata` and skipped by `Puffin`, as the Puffin specification requires, instead of failing the read. Related: #131249 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…update_theta_sketch` The batch hash only saved a virtual `getDataAt` call per row, at the cost of a new `IColumn` method used in one place and a CMake workaround for the two `MurmurHash3.h` headers. The values are still encoded as before (a cast to a type whose `getDataAt` bytes are the Iceberg single-value serialization, and explicit encoding of decimals and `UUID`), but each value now goes to `update_theta_sketch::update`, which computes the same hash. This also removes the direct use of DataSketches internals (`theta_update_sketch_base`). The written sketches do not change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dy and style - Build `PuffinThetaSketchBuilder` and its helpers only with DataSketches: in the fast test build it was an unused class (`-Wunused-member-function`). - Mark const getters `[[nodiscard]]` (`modernize-use-nodiscard`). - Use `VectorWithMemoryTracking` and `UnorderedSetWithMemoryTracking` for the field ids. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121982&sha=7ccc69308b7c7cf5b1aafd1b71b633d222439f1a&name_0=PR PR: #121982 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t independent references The Puffin specification makes `properties` and the `ndv` property of `apache-datasketches-theta-v1` blobs optional, so `ndv` is validated only when present. Before, such a blob also made `Puffin` fail to read the deletion vectors of the same file. `05813_puffin_theta_sketch_reference_hashes` compares the hashes stored in the written sketches with the ones computed by `data_puffin/generate_theta_reference_hashes.py`, which encodes the values with the Iceberg single-value serialization and hashes them as Apache DataSketches does, without ClickHouse. Related: #121982 Co-Authored-By: Claude Opus 5.5 <[email protected]>
murphy-4o
left a comment
There was a problem hiding this comment.
LGTM, please check these comments and fix ai review
…tor positions, fix clang-tidy - Writing `apache-datasketches-theta-v1` blobs now requires `output_format_puffin_field_ids`, `output_format_puffin_snapshot_id` and `output_format_puffin_sequence_number`: default field ids 1..n and snapshot id -1 produce statistics that readers accept but attach to wrong columns or skip. - Deletion vector positions are added per run of rows with the same data file through `Roaring64Map::addMany` from the typed column, instead of `getUInt`/`add` per position. - Rename `IPuffinBlobBuilder::reset` to `clear` (`readability-ambiguous-smartptr-reset-call`). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Remove `output_format_puffin_blob_type`, `output_format_puffin_field_ids`, `output_format_puffin_snapshot_id` and `output_format_puffin_sequence_number`. The `Puffin` output format writes deletion vectors only; the Theta sketch builder takes the field ids, the snapshot id and the sequence number in `PuffinThetaSketchBlobOptions` from its caller, the Iceberg statistics writer. The tests that wrote Theta sketches through the format settings are removed. Write single deleted positions with `Roaring64Map::add`, `addMany` is slower for one value. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…uilder as a struct Bring back `output_format_puffin_blob_type`, `output_format_puffin_field_ids`, `output_format_puffin_snapshot_id`, `output_format_puffin_sequence_number`, the format docs and the Theta tests removed in the previous commit. The settings are parsed once in `createPuffinBlobBuilder` into `PuffinThetaSketchBlobOptions`, which the Theta sketch builder takes instead of `FormatSettings`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Use master's Puffin layer (ClickHouse#121982) instead of PuffinFile.{h,cpp}.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Puffin output format (iceberg v3 related feature)
Workflow [PR]
Sync PR [sync-upstream/pr/121982]
Version info
26.11.1.2632-master(included in26.11and later)