Repository navigation
feat(table): classify deletion vectors in scan planning - #855
Merged
Merged
Conversation
laskoviymishka
marked this pull request as ready for review
April 6, 2026 05:28
Separate deletion vectors from regular positional delete files during scan planning. DVs are identified by having ReferencedDataFile set on a positional delete manifest entry (Iceberg v3 spec). - Add dvEntries bucket to manifestEntries with isDeletionVector() helper - In collectManifestEntries: route DV entries separately from pos deletes - Add DeletionVectorFiles field to FileScanTask - Index DVs by referenced data file path for O(1) matching in PlanFiles - Unit tests for classification, matching, and FileScanTask field Part of apache#589 (v3 deletion vector support).
laskoviymishka
force-pushed
the
feat/dv-scan-planning
branch
from
April 6, 2026 23:50
7a47cb5 to
139e283
Compare
zeroshade
requested changes
Apr 7, 2026
| File iceberg.DataFile | ||
| DeleteFiles []iceberg.DataFile // positional delete files | ||
| EqualityDeleteFiles []iceberg.DataFile // equality delete files | ||
| DeletionVectorFiles []iceberg.DataFile // deletion vectors (puffin files) |
Member
There was a problem hiding this comment.
since the actual scanner will ignore these, we should probably also update the scanner to error if this is non-empty just so people don't think it's working.
Separate deletion vectors from regular positional delete files during scan planning. DVs are identified by having ReferencedDataFile set on a positional delete manifest entry (Iceberg v3 spec). - Add dvEntries bucket to manifestEntries with isDeletionVector() helper - In collectManifestEntries: route DV entries separately from pos deletes - Add DeletionVectorFiles field to FileScanTask - Index DVs by referenced data file path for O(1) matching in PlanFiles - Scanner errors if DeletionVectorFiles is non-empty (read not yet implemented) - Unit tests for classification, matching, and FileScanTask field Part of apache#589 (v3 deletion vector support).
laskoviymishka
force-pushed
the
feat/dv-scan-planning
branch
from
April 7, 2026 20:54
139e283 to
f0dec1a
Compare
zeroshade
approved these changes
Apr 7, 2026
96 tasks done
This was referenced May 5, 2026
laskoviymishka
added a commit
to laskoviymishka/iceberg-go
that referenced
this pull request
May 10, 2026
Three review angles converged on a panic race in readAllDeletionVectors: the prior implementation validated DV manifest entries (missing referenced_ data_file) inside the goroutine-dispatch loop, so a bad entry encountered after one or more g.Go calls would defer-close the results channel while in-flight workers were still sending — runtime panic, not a clean error. Move validation to a pre-pass before any goroutines launch. Spec correctness: dedup was keyed by puffin file path, which silently drops DV blobs when one puffin file holds multiple deletion vectors (the spec permits this; iceberg-rust and PyIceberg are not affected because they key differently). Switch to keying by referenced data file path — the natural semantic key, matching Java's DeleteFileIndex.findDV. Also reject two distinct DV blobs that target the same data file (sameDVBlob compares puffin path + content offset), mirroring Java's "Can't index multiple DVs for %s" ValidationException — silent unioning is an over-deletion bug. Public API: add Iter() iter.Seq[uint64] as the primary RoaringPositionBitmap iteration method (Go 1.25 idiomatic, lazy). Keep ToArray as a convenience wrapper over slices.AppendSeq. bitmapToInt64Chunked now consumes Iter directly, avoiding the intermediate []uint64 allocation that previously doubled memory for large DVs. Tests: - Compute the puffin blob's cardinality property from the actual bitmap rather than the prior hardcoded "5", so fixtures built with other position counts don't carry misleading metadata. - Drop the misleading filesize field that was set to blob length instead of full puffin file size. - Add subtest for "multiple distinct DV blobs for same data file rejected". - Add a regression subtest with require.NotPanics for the close-on-closed- channel race — would have caught the original bug. - Add a compile-time assertion that readAllDeletionVectors and readAllDeleteFiles return the same perFilePosDeletes type, so the merge in GetRecords is type-safe by construction. - Helper newDVMockDataFile dedups the dvMockDataFile boilerplate; TODO comment marks the hand-built DV envelope for replacement once apache#1041 exports dv.SerializeDV. Deferred (pre-existing, not introduced here): - Multiple DVs per data file silently unioned in scanner.go's PlanFiles (from apache#855) — addressed defensively in the reader here, follow-up to enforce at planning time. - DV sequence-number guard missing in PlanFiles. - ReadDV skips cardinality validation when dvFile.Count() is 0. - Puffin reader doesn't validate DV's required snapshot-id=-1/sequence- number=-1.
laskoviymishka
added a commit
to laskoviymishka/iceberg-go
that referenced
this pull request
May 10, 2026
Closes apache#996. v3 tables with deletion vectors are now readable end-to-end. Before this change, arrow_scanner.go's GetRecords returned ErrNotImplemen- ted for any task carrying a DV manifest entry, and scan planning paired DVs with their data files but never read the bitmaps. This wires those plans through to the row-filter pipeline. Scanner read path. readAllDeletionVectors mirrors readAllDeleteFiles in shape — concurrent reads via errgroup, returns a perFilePosDeletes map keyed by referenced data file path. A compile-time signature assertion in the test file pins that both loaders share the perFilePosDeletes return type, so the merge in GetRecords (`deletesPerFile[file] = append(...)`) is type-safe by construction. The downstream collapse into a set[int64] inside recordsFromTask / producePosDeletesFromTask absorbs both sources without pipeline changes. Dedup is by referenced-data-file path, not by puffin file path: the spec permits one puffin file to carry multiple DV blobs (one per data file), and keying by the puffin path would silently drop all but the first. The same loop rejects (a) DV entries missing referenced_data_file or content_offset / content_size_in_bytes, (b) two distinct DV blobs (different puffin path OR content offset) targeting the same data file — the latter mirrors Java's DeleteFileIndex "Can't index multiple DVs for %s" ValidationException, since silently unioning two bitmaps is an over-deletion bug. Same-blob dedup across multiple tasks is a no-op (deliberate divergence from Java's stricter rejection — re-reading the same blob is wasteful, not incorrect). Validation runs entirely up front before any goroutine launches. An earlier draft mixed validation into the goroutine-dispatch loop, which created a close-on-closed-channel panic when a bad entry was reached after one or more g.Go calls had dispatched workers still trying to send to the result channel. The current shape — populate uniqueDVs in a serial pre-pass, then fan out — makes that state unreachable by construction. On goroutine error, accumulated *arrow.Chunked values are released before returning, since arrow.NewChunked allocations are not freed by GC alone. bitmapToInt64Chunked materializes a bitmap as a chunked Int64 array via the new dv.RoaringPositionBitmap.Iter() iter.Seq[uint64] method. Lazy iteration avoids the intermediate []uint64 allocation that would double memory pressure for large DVs. The Reserve hint is clamped to math.Max- Int so a 32-bit int build (or a future raised puffin blob-size limit) can't wrap the Cardinality int64 cast to a negative reservation. The int64(p) position cast trusts dv.DeserializeDV as the bytes-to-bitmap boundary — positions ≥ 2^63 would wrap, but the spec bounds positions by the data file's row count, well under that limit. scanner.go: a data file with an applicable DV no longer also has its Parquet position-delete files matched. Spec §Scan Planning predicate "There is no deletion vector that must be applied to the data file" is a precondition for pos-delete application, and Java's DeleteFileIndex. forDataFile enforces it. The gap was latent before this PR because GetRecords errored on DVs; making DVs readable also makes pairing DV+pos-deletes for the same file observable. For spec-compliant tables the set-union absorbs the overlap, but a writer whose DV omits prior pos-delete positions would silently over-delete. dv package: RoaringPositionBitmap gains Iter() (primary, lazy) and ToArray() (convenience wrapper via slices.AppendSeq). The Iter contract is single-goroutine / no-mutation-mid-iteration — the closure captures the bitmap by pointer and roaring.Bitmap doesn't support concurrent Set/Iterator. Tests build a real puffin file via puffin.Writer rather than vendoring fixture bytes, so this PR is independent of apache#1041's golden fixture. Coverage: position decoding and dedup keying by referenced data file, identical-DV dedup across multiple tasks, no-tasks no-op, the four rejection paths (missing referenced_data_file, missing content_offset, multiple distinct DVs for same data file, nil-ref-before-goroutine- dispatch panic regression), and the compile-time signature assertion. TODO(apache#1041) marks the hand-built DV envelope in writeDVPuffinFixture for replacement once that PR exports dv.SerializeDV. End-to-end coverage (DV positions actually filtered out of GetRecords output for a real Parquet data file) is deferred — would need v3 table- metadata scaffolding outside this PR's scope. Several adjacent gaps are also deferred as follow-ups: DV sequence-number guard in PlanFiles (pre-existing from apache#855), tighter ReadDV cardinality validation (pre- existing from apache#866), Puffin reader DV snapshot-id/sequence-number guard (pre-existing from apache#676), and the parallel arrow-leak in readAllDelete- Files (pre-existing).
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
iceberg-cli 0.6.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## What's Changed * build(deps): bump the gomod_updates group with 18 updates by @dependabot[bot] in apache/iceberg-go#763 * build(deps): bump go.opentelemetry.io/otel/sdk from 1.39.0 to 1.40.0 by @dependabot[bot] in apache/iceberg-go#764 * fix: nil field Type causes unrecovered panic in MarshalJSON by @shtripat in apache/iceberg-go#765 * fix(manifest): handle lifecycle of the decoder in reader by @ferhatelmas in apache/iceberg-go#766 * feat(rest): add RegisterView to REST catalog by @shtripat in apache/iceberg-go#753 * fix(table): fix refcount leak in enrichRecordsWithPosDeleteFields by @laskoviymishka in apache/iceberg-go#762 * chore: Update copyright year in NOTICE file by @zeroshade in apache/iceberg-go#771 * refactor: make partition spec and sort order fields range friendly by @ferhatelmas in apache/iceberg-go#772 * feat(table): roll parquet files based on actual compressed size by @twuebi in apache/iceberg-go#759 * fix(table): ensure partition path is deterministic by @ferhatelmas in apache/iceberg-go#767 * build(deps): bump the gomod_updates group across 1 directory with 12 updates by @dependabot[bot] in apache/iceberg-go#782 * fix: skip pageSize query param when value is 0 by @alessandro-nori in apache/iceberg-go#778 * fix: handle LargeString columns in partition transforms by @hamilton-earthscope in apache/iceberg-go#780 * fix(table): removeSnaphosts postCommit now takes effect by @starpact in apache/iceberg-go#783 * feat: Implemented write-default and initial-default v3 by @PranjalChaitanya in apache/iceberg-go#779 * feat(table): add Scan.ReadTasks for reading pre-planned file scan tasks by @twuebi in apache/iceberg-go#781 * feat(table): export StructLike and GetPartitionRecord by @twuebi in apache/iceberg-go#791 * feat(catalog): refresh oauth tokens by @rockwotj in apache/iceberg-go#793 * feat(table): public write DataFile API by @twuebi in apache/iceberg-go#776 * fix: remove unnecessary safe-guard by @twuebi in apache/iceberg-go#775 * fix(table): don't always set schema.name-mapping.default by @rockwotj in apache/iceberg-go#803 * build(deps): bump google.golang.org/grpc from 1.79.2 to 1.79.3 by @dependabot[bot] in apache/iceberg-go#804 * feat(table): add RowDelta API for atomic row-level mutations by @laskoviymishka in apache/iceberg-go#789 * feate(hive): Add Create View for Hive catalog by @dttung2905 in apache/iceberg-go#788 * build(deps): bump the gomod_updates group with 2 updates by @dependabot[bot] in apache/iceberg-go#807 * fix(table): AddFiles: close file after usage and parallelize by @starpact in apache/iceberg-go#799 * feat(catalog): add TransactionalCatalog interface and REST multi-table commit by @laskoviymishka in apache/iceberg-go#787 * feat(catalog,io): refresh vended credentials by @rockwotj in apache/iceberg-go#795 * fix(table): AddFiles() should respect commit.manifest-merge.enabled by @RSP22 in apache/iceberg-go#806 * feat(table): configure Parquet DataPage version by @laskoviymishka in apache/iceberg-go#812 * chore: add CODEOWNERS file by @zeroshade in apache/iceberg-go#814 * fix(table): deadlock in MapExec when workers error by @laskoviymishka in apache/iceberg-go#810 * fix(table): add warnings for silent data-affecting behavior by @laskoviymishka in apache/iceberg-go#811 * build(deps): bump github.com/moby/buildkit from 0.27.1 to 0.28.1 by @dependabot[bot] in apache/iceberg-go#813 * feat(hive): adding register table in hive catalog by @Hashcode-Ankit in apache/iceberg-go#816 * feat(table): equality delete write path by @laskoviymishka in apache/iceberg-go#809 * feat(catalog): add CommitAndReload, error ctx, and 404 test for multi-tx by @laskoviymishka in apache/iceberg-go#817 * feat(types): add Parquet support for nanosecond timestamp types (v3) by @laskoviymishka in apache/iceberg-go#819 * build(deps): bump the gomod_updates group with 6 updates by @dependabot[bot] in apache/iceberg-go#822 * feat(table): enforce write-default and initial-default for required fields by @laskoviymishka in apache/iceberg-go#820 * feat(table): equality delete read path in scanner by @laskoviymishka in apache/iceberg-go#818 * feat(rest): add audience and resource params to OAuth requests by @lovromazgon in apache/iceberg-go#815 * feat(table): equality delete writing for partitioned tables by @laskoviymishka in apache/iceberg-go#823 * fix(table): goroutine leak in positionDeleteRecordsToDataFiles by @hcrosse in apache/iceberg-go#825 * fix(manifest): default to v1 files by @rockwotj in apache/iceberg-go#826 * feat(table): add Transaction.UpgradeFormatVersion by @rockwotj in apache/iceberg-go#827 * feat(table): multi-arg transforms in partition and sort fields by @laskoviymishka in apache/iceberg-go#824 * build(deps): bump github.com/go-jose/go-jose/v4 from 4.1.3 to 4.1.4 by @dependabot[bot] in apache/iceberg-go#828 * Thread context.Context through deletedEntries() by @Herrtian in apache/iceberg-go#847 * feat(table): Add statistics files to orphan cleanup referenced set by @dttung2905 in apache/iceberg-go#848 * build(deps): bump the gomod_updates group with 5 updates by @dependabot[bot] in apache/iceberg-go#854 * fix(ci): resolve flaky integration-setup by @laskoviymishka in apache/iceberg-go#858 * bench(table): read-perf degradation under equality delete pressure by @laskoviymishka in apache/iceberg-go#852 * fix(table): read Parquet batch size from table properties by @gabrnavarro in apache/iceberg-go#849 * feat(table): Add OpReplace to updateSnapshotSummaries by @dttung2905 in apache/iceberg-go#853 * feat(table): strengthen orphan-cleanup stats referenced-set tests and document empty-path guard by @dttung2905 in apache/iceberg-go#856 * fix: require Transform in NewSortOrder and add related tests by @Narwhal-fish in apache/iceberg-go#859 * feat(table): support delete file removal in overwrite commits by @laskoviymishka in apache/iceberg-go#851 * feat(table): classify deletion vectors in scan planning by @laskoviymishka in apache/iceberg-go#855 * build(deps): bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp from 1.41.0 to 1.43.0 by @dependabot[bot] in apache/iceberg-go#864 * feat(table): add bin-pack compaction strategy by @laskoviymishka in apache/iceberg-go#850 * build(deps): bump go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp from 1.38.0 to 1.43.0 by @dependabot[bot] in apache/iceberg-go#862 * fix: handle missing format-version in NewManifestReader for v1 manifests by @rockwotj in apache/iceberg-go#868 * docs: expand CONTRIBUTING.md with issue claiming and PR guidelines by @laskoviymishka in apache/iceberg-go#887 * build(deps): bump the gomod_updates group with 4 updates by @dependabot[bot] in apache/iceberg-go#872 * fix(table): prune StatisticsList and PartitionStatsList in RemoveSnapshots by @alliasgher in apache/iceberg-go#873 * fix(table): read retention table properties as defaults in ExpireSnapshots by @alliasgher in apache/iceberg-go#877 * feat(table): wire bloom filter properties into Parquet writer by @alliasgher in apache/iceberg-go#878 * fix(table): populate WriteTask.SortOrderID in data file writers by @alliasgher in apache/iceberg-go#875 * fix(schema): reject duplicate field IDs at schema construction by @alliasgher in apache/iceberg-go#879 * fix: emit proper Avro fixed schema for FixedType partition columns (#845) by @tanmayrauth in apache/iceberg-go#881 * fix(table): delete statistics files in ExpireSnapshots PostCommit #837 by @tanmayrauth in apache/iceberg-go#882 * refactor(table): collapse DataFileStatistics.ToDataFile args into DataFileOpts by @alliasgher in apache/iceberg-go#888 * perf(table): Decrease memory pressure by releasing records by @abhirathod95 in apache/iceberg-go#886 * fix(deletes): change equality_ids array elements avro schema type from Long to Integer to match spec by @rohilsurana in apache/iceberg-go#880 * feat(avro): replace hamba/avro with twmb/avro v1.5.0 by @twmb in apache/iceberg-go#871 * feat(compaction): add Analyze for dry-run compaction planning by @laskoviymishka in https://github.com/apache/iceberg-go/pull/ See merge request: Harmonybrew/homebrew-core!9291
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Separate deletion vectors from regular positional delete files during scan planning. DVs are identified by having ReferencedDataFile set on a positional delete manifest entry (Iceberg v3 spec).
Part of #589 (v3 deletion vector support).