Repository navigation
Conversation
Wire manifest parsing for puffin delete entries, load deletion-vector-v1 blobs into excluded_rows, and apply them during Iceberg table reads. Co-authored-by: Cursor <[email protected]>
Add headers required to compile ReadBufferFromFileBase and RoaringBitmapWithSmallSet usage. Co-authored-by: Cursor <[email protected]>
Track PuffinFilesRead count and PuffinFileReadMicroseconds when reading puffin footers and deletion-vector blobs. Co-authored-by: Cursor <[email protected]>
Cover multi-step inserts, deletes, schema evolution, updates, and Spark rewrite_data_files compaction in integration and stateless fixtures. Co-authored-by: Cursor <[email protected]>
Introduce an in-memory SLRU cache on global Context for parsed puffin file content, with server/session settings and SYSTEM DROP PUFFIN FILES CACHE support. Co-authored-by: Cursor <[email protected]>
Align the parser alias and access type name with other cache drop commands such as SYSTEM DROP PARQUET_METADATA_CACHE. Co-authored-by: Cursor <[email protected]>
Use the global cache when use_puffin_files_cache is enabled and puffin file etag is available, and add a stateless test for cache hit/miss behavior.
Cover cache hit/miss behavior in stateless and S3 integration tests, document SYSTEM DROP PUFFIN_FILES_CACHE, and extend parser and privileges coverage. Co-authored-by: Cursor <[email protected]>
Deletion vector row positions are meaningful only for a specific data file, so cache entries must not be shared across different referenced_data_file values that reuse the same puffin blob slice. Co-authored-by: Cursor <[email protected]>
Iceberg reads manifest offset and length directly, so check offset + length against the puffin file size before allocation to reject corrupt metadata early. Co-authored-by: Cursor <[email protected]>
Callers must not share the mutable cached ExcludedRows instance, so getOrSetDeletionVector now returns an independent copy on every hit and miss. Co-authored-by: Cursor <[email protected]>
Cardinality-based weight underestimated sparse roaring bitmaps, so cache byte limits could be exceeded; use getAllocatedBytes instead. Co-authored-by: Cursor <[email protected]>
Repeated reads of data files with zero deleted rows should skip puffin I/O, so treat cached nullptr as an explicit empty deletion vector and account for it with a tiny cache entry weight. Co-authored-by: Cursor <[email protected]>
Enforce the shared puffin materialization ceiling and early roaring cardinality checks on Iceberg reads by wiring manifest record_count into readDeletionVectorFromPuffin. Co-authored-by: Cursor <[email protected]>
Fail closed with NOT_IMPLEMENTED before loading puffin DVs when the data file is not Parquet, matching position-delete behavior and avoiding LOGICAL_ERROR in DeletionVectorTransform. Co-authored-by: Cursor <[email protected]>
ConstChunkGenerator bypasses DeletionVectorTransform, and the cache key is data-file identity only while Iceberg deletion vectors change independently. Co-authored-by: Cursor <[email protected]>
…reader. Reject mismatched magic or combined_length before a full up-to-2GiB blob allocate/read on the Iceberg path, matching the SQL Puffin format guard. Co-authored-by: Cursor <[email protected]>
Downgrading to protocol <5 previously omitted deletion/selection vectors and could return deleted rows on mixed-version workers. Co-authored-by: Cursor <[email protected]>
Restore expected_cardinality, materialization/blob ceilings, and little-endian roaring parsing that landed via skipped fix-puffin-deletion-vector-v1 merges, so Iceberg callers and further cherry-picks match the shared API. Co-authored-by: Cursor <[email protected]>
Manifest record_count above the materialization ceiling can fail closed without peeking or allocating up to the 2 GiB blob cap. Co-authored-by: Cursor <[email protected]>
ObjectIteratorSplitByBuckets previously sliced IcebergDataObjectInfo to ObjectInfo, dropping equality and position deletes under BUCKET granularity. Co-authored-by: Cursor <[email protected]>
…unt cache. Bucketed cluster tasks previously counted whole files and could poison the schema row-count cache with partial totals under a file-only key. Co-authored-by: Cursor <[email protected]>
…umbers. Equality FilterTransform shrinks chunks without updating ChunkInfoRowNumbers::applied_filter; running DeletionVectorTransform first keeps DV positions mapped to absolute file rows. Co-authored-by: Cursor <[email protected]>
…ion deletes. Protocol versions below WITH_ICEBERG_METADATA omit iceberg_info, so workers would skip delete transforms and return deleted rows; reject those tasks instead. Co-authored-by: Cursor <[email protected]>
…locate. Mirror the shared Iceberg reader: when deleted_rows is projected, fail closed on footer cardinality above the materialization ceiling before reading the blob. Co-authored-by: Cursor <[email protected]>
Protocol versions below WITH_FILE_BUCKETS_INFO omit bucket subsetting, so workers would re-read whole files per bucket task and return duplicated rows. Co-authored-by: Cursor <[email protected]>
Trivial count and need_only_count cannot apply equality filters correctly; also skip the file count cache for equality and position deletes whose identity is not in the cache key. Co-authored-by: Cursor <[email protected]>
Share one canUseCountFromFilesCache helper between read and cache-write paths, and keep only the positive equality-before-DV mapping test. Co-authored-by: Cursor <[email protected]>
Protocol versions below Iceberg metadata support omit iceberg_info entirely, so workers must not silently drop schema IDs and file format even when delete lists are empty. Co-authored-by: Cursor <[email protected]>
Puffin v1 requires these footer fields to be unknown placeholders; accept only the specified values in parse and Iceberg bind. Co-authored-by: Cursor <[email protected]>
Row policies and PREWHERE reduce emitted rows while the cache key is file identity only; treat them like filter DAGs in FormatFilterInfo::hasFilter. Co-authored-by: Cursor <[email protected]>
Match the Iceberg reader fail-closed order so SQL FORMAT Puffin does not I/O or allocate up to 2 GiB when footer cardinality exceeds the materialization ceiling. Co-authored-by: Cursor <[email protected]>
Use false as previous_value so SET compatibility can disable the new default-on Puffin files cache on older Antalya versions. Co-authored-by: Cursor <[email protected]>
Iceberg v3 writers must not add position-delete files; fail closed until deletion-vector writes are implemented. Co-authored-by: Cursor <[email protected]>
Equality deletes still demote the fast path; count-from-files cache stays fail-closed separately so DV count can use Parquet metadata plus bitmap cardinality. Co-authored-by: Cursor <[email protected]>
Coalesced multi-DV Puffin files shared one footer parse per file instead of reparsing the full footer on every deletion-vector slice miss. Co-authored-by: Cursor <[email protected]>
Empty deletion vectors no longer weigh one byte; long unique keys are bounded by the configured byte limit even when max entries is unlimited. Co-authored-by: Cursor <[email protected]>
Replace the sibling CacheBase footer LRU and its metrics with a count-bounded mutex map so coalesced multi-DV files still parse once. Co-authored-by: Cursor <[email protected]>
Clear and disable footer memoization when the cache size is 0, and bound retained footers by the same approximate byte budget as DVs. Co-authored-by: Cursor <[email protected]>
CI pre-sets send_logs_level to warning, so the previous :-error default did not suppress IcebergMetadata v1/v2 schema fallback Warnings on stderr. Co-authored-by: Cursor <[email protected]>
|
Hello, thank you for your contribution! To make review easier, would it be possible to split this diff into multiple smaller PRs? For example, I think some of the changes in CacheBase.h, Reader.cpp, FormatFilterInfo, PuffinBlockInputFormat.cpp, and src/AggregateFunctions/AggregateFunctionGroupBitmapData.h could be filed as a preparatory PR. |
|
Actually, there's another PR open that implements deletion vectors: #110781, and I'd like to merge that one first. If it's okay with both you and @linjiayu1025-collab, I would like to adapt some of these tests for that PR, with co-authored-by credit so that the work is still attributed to you. There are other great changes in here, especially the fixes for FormatFilterInfo, the clone() fix in IcebergDataObjectInfo, the count() optimizations, and the caching. Could you please open these as separate small PRs? The fixes and hardening can go up right away. Count() optimizations and caching will need to wait for #110781 to merge. |
|
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. |
|
Closing this PR. Please feel free to open the changes mentioned above (the fixes for FormatFilterInfo, the clone() fix in IcebergDataObjectInfo, the count() optimizations, and the caching) in a separate PR. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Iceberg deletion vectors support
Goal
Add read support for Iceberg v3 Puffin deletion vectors (
deletion-vector-v1) so ClickHouse applies DV bitmaps when reading Iceberg tables (local / object storage / cluster), without writing DVs.Also expose SQL input formats
Puffin/PuffinMetadatafor inspecting Puffin files, and a process-global Puffin files cache for parsed DV bitmaps.High-level architecture
Shared Puffin parsing / DV deserialize lives under:
PuffinDeletionVectorReaderPuffinFilesCacheIcebergDeletionVectorrecord_countinput_format_allow_seeks = 0).Feature behavior (what users get)
content = 2/ deletion vectors).data − deletesarithmetic.excluded_rowsor delete metadata (no silent drop of deletes).SYSTEM DROP PUFFIN FILES CACHE(spaced form; underscore alias accepted) clears the cache; gated by access control.use_puffin_files_cacheand related server/cache size settings (seeSettings/ docs).Safety / fail-closed decisions (intentional)
Reviewers should treat these as product decisions, not accidental omissions:
(content_offset, content_size)matchingreferenced_data_file+ cardinality.< data_file.record_count.isEtagUsableAsCacheKey).excluded_rowsis present.Explicitly out of scope / deferred (workspace rule): Poco JSON
Int64wrap of2^63/2^63+1— do not treat as a defect to fix in this PR.Tests (where to look)
Unit / gtest
CacheBase/ LRU:getOrSetWithOutcome*Stateless
allow_seeks=0, stdin pipe, error fixtures undertests/queries/0_stateless/data_puffin/SYSTEM DROP PUFFIN FILES CACHEparsing / privilegesIntegration
tests/integration/test_storage_iceberg_with_spark/test_deletion_vectors.pydata_minio/(dv_puffin_*), generatorgenerate_iceberg_dv_fixture.pyDocs touched
Puffin/PuffinMetadataformatsSYSTEM DROP PUFFIN FILES CACHE