You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by at...@apache.org on 2026/07/09 17:01:46 UTC
(iceberg-go) branch main updated: docs(table): clarify mixed-group lineage-drop behavior (#1392)
This is an automated email from the ASF dual-hosted git repository.
laskoviymishka pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git
The following commit(s) were added to refs/heads/main by this push:
new 0e3f7679 docs(table): clarify mixed-group lineage-drop behavior (#1392)
0e3f7679 is described below
commit 0e3f7679b2b0a5fec3d8df67f7695175b4f6eb6d
Author: Minh Vu <vu...@gmail.com>
AuthorDate: Thu Jul 9 19:01:41 2026 +0200
docs(table): clarify mixed-group lineage-drop behavior (#1392)
## Summary
- Clarify the current mixed-group row-lineage fallback in compaction on
v3 tables.
- Document that mixed groups can appear during a v1/v2->v3 migration
because `first_row_id` is assigned lazily at the next v3 manifest-list
write.
- Keep the existing conservative behavior: when a mixed group is
compacted, `_row_id` is dropped for the merged output.
- Restore the warning text and helper docs so they describe the current
behavior accurately.
## Testing
- `go test ./table -run
'TestExecuteCompactionGroupPreservesRowIDAcrossV2Upgrade|TestExecuteCompactionGroupPreservesRowID|TestCoWRewritePreservesRowID|TestCoWRewriteRowIDNextRowIDAccounting'
-count=1`
---
table/rewrite_data_files.go | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/table/rewrite_data_files.go b/table/rewrite_data_files.go
index b9982057..ad79ddf0 100644
--- a/table/rewrite_data_files.go
+++ b/table/rewrite_data_files.go
@@ -305,19 +305,17 @@ func ExecuteCompactionGroup(ctx context.Context, tbl *Table, group CompactionTas
// legacy files on a v3 table) would otherwise produce one output where
// post-lineage rows have explicit _row_id values and pre-lineage rows
// have nulls, which violates the per-file uniqueness/coverage
- // invariant the v3 spec requires. Splitting mixed groups into separate
- // outputs is a larger refactor and is left as a follow-up; for now we
- // degrade gracefully (the rewrite still succeeds, but lineage is not
- // preserved for the surviving rows).
+ // invariant the v3 spec requires. Row IDs are assigned lazily during
+ // the first v3 manifest-list write after a v1/v2->v3 upgrade, so mixed
+ // groups are expected during migration; for now we degrade gracefully
+ // and do not preserve lineage for the surviving rows.
preserveLineage := tbl.metadata.Version() >= 3 && allTasksHaveRowLineage(group.Tasks)
if preserveLineage {
scanOpts = append(scanOpts, WithRowLineage())
} else if tbl.metadata.Version() >= 3 {
- // Mixed group on a v3 table — at least one source file lacks
- // FirstRowID so we drop lineage on the surviving rows. This is the
- // common case during a v1/v2→v3 migration; surface it so operators
- // can detect silent lineage loss instead of having to diff
- // metadata before/after.
+ // Drop lineage for the whole mixed group. Warn only when at least one
+ // source file already carried lineage; all-legacy groups fall through
+ // silently because there is no lineage to lose.
var lineageFiles, legacyFiles int
for _, t := range group.Tasks {
if t.FirstRowID != nil {
@@ -390,9 +388,7 @@ func ExecuteCompactionGroup(ctx context.Context, tbl *Table, group CompactionTas
// allTasksHaveRowLineage returns true iff every task in the group has a
// non-nil FirstRowID — i.e. every source file already carries v3 row lineage.
-// Used to gate the preservation path on compaction: mixed groups (some
-// lineage, some legacy) would otherwise produce per-file invariant
-// violations, so the gate is conservative.
+// It returns false for an empty task slice.
func allTasksHaveRowLineage(tasks []FileScanTask) bool {
if len(tasks) == 0 {
return false