-
Notifications
You must be signed in to change notification settings - Fork 3k
Core, API: BaseRowDelta, BaseOverwrite,BaseReplacePartitions, BaseRewrite to branch Impl #5234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9e43889
e6ea5f6
b43b80b
9cb39c2
ba341ec
d1ca432
0d79ef0
495c0f3
f7464eb
39de1e4
7e75c68
080d76e
1dc4f89
41b2f62
0c18302
0acca3b
49b6667
4ab3414
fb28c02
cfc5e67
70a3cf3
a64b837
f9b3d67
cd5569c
3d5659b
0028bcd
7173dcb
caf9d59
4f64b09
90f23ab
4b8ac6d
c6df1e7
defff1d
66e1850
fc8780c
6b6aefc
1a98e54
74bab58
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,23 +79,32 @@ public ReplacePartitions validateNoConflictingData() { | |
| return this; | ||
| } | ||
|
|
||
| @Override | ||
| public BaseReplacePartitions toBranch(String branch) { | ||
| targetBranch(branch); | ||
| return this; | ||
| } | ||
|
|
||
| @Override | ||
| public void validate(TableMetadata currentMetadata, Snapshot snapshot) { | ||
| if (validateConflictingData) { | ||
| if (dataSpec().isUnpartitioned()) { | ||
| validateAddedDataFiles(currentMetadata, startingSnapshotId, Expressions.alwaysTrue()); | ||
| validateAddedDataFiles( | ||
| currentMetadata, startingSnapshotId, Expressions.alwaysTrue(), snapshot); | ||
| } else { | ||
| validateAddedDataFiles(currentMetadata, startingSnapshotId, replacedPartitions); | ||
| validateAddedDataFiles(currentMetadata, startingSnapshotId, replacedPartitions, snapshot); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: I think it makes more sense to use |
||
| } | ||
| } | ||
|
|
||
| if (validateConflictingDeletes) { | ||
| if (dataSpec().isUnpartitioned()) { | ||
| validateDeletedDataFiles(currentMetadata, startingSnapshotId, Expressions.alwaysTrue()); | ||
| validateNoNewDeleteFiles(currentMetadata, startingSnapshotId, Expressions.alwaysTrue()); | ||
| validateDeletedDataFiles( | ||
| currentMetadata, startingSnapshotId, Expressions.alwaysTrue(), snapshot); | ||
| validateNoNewDeleteFiles( | ||
| currentMetadata, startingSnapshotId, Expressions.alwaysTrue(), snapshot); | ||
| } else { | ||
| validateDeletedDataFiles(currentMetadata, startingSnapshotId, replacedPartitions); | ||
| validateNoNewDeleteFiles(currentMetadata, startingSnapshotId, replacedPartitions); | ||
| validateDeletedDataFiles(currentMetadata, startingSnapshotId, replacedPartitions, snapshot); | ||
| validateNoNewDeleteFiles(currentMetadata, startingSnapshotId, replacedPartitions, snapshot); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |||
| import org.apache.iceberg.expressions.Expressions; | ||||
| import org.apache.iceberg.relocated.com.google.common.base.Preconditions; | ||||
| import org.apache.iceberg.util.CharSequenceSet; | ||||
| import org.apache.iceberg.util.SnapshotUtil; | ||||
|
|
||||
| class BaseRowDelta extends MergingSnapshotProducer<RowDelta> implements RowDelta { | ||||
| private Long startingSnapshotId = null; // check all versions by default | ||||
|
|
@@ -96,23 +97,37 @@ public RowDelta validateNoConflictingDeleteFiles() { | |||
| } | ||||
|
|
||||
| @Override | ||||
| protected void validate(TableMetadata base, Snapshot snapshot) { | ||||
| if (base.currentSnapshot() != null) { | ||||
| public RowDelta toBranch(String branch) { | ||||
| targetBranch(branch); | ||||
| return this; | ||||
| } | ||||
|
|
||||
| @Override | ||||
| protected void validate(TableMetadata base, Snapshot parent) { | ||||
| if (parent != null) { | ||||
| if (startingSnapshotId != null) { | ||||
| Preconditions.checkArgument( | ||||
| SnapshotUtil.isAncestorOf(parent.snapshotId(), startingSnapshotId, base::snapshot), | ||||
| "Snapshot %s is not an ancestor of %s", | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a bit more context would be helpful if you ever encounter this error.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @amogh-jahagirdar Is this ancestor check even required anymore ? We are anyway doing ancestor check in
|
||||
| startingSnapshotId, | ||||
| parent.snapshotId()); | ||||
| } | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: whitespace after this block. |
||||
| if (!referencedDataFiles.isEmpty()) { | ||||
| validateDataFilesExist( | ||||
| base, | ||||
| startingSnapshotId, | ||||
| referencedDataFiles, | ||||
| !validateDeletes, | ||||
| conflictDetectionFilter); | ||||
| conflictDetectionFilter, | ||||
| parent); | ||||
| } | ||||
|
|
||||
| if (validateNewDataFiles) { | ||||
| validateAddedDataFiles(base, startingSnapshotId, conflictDetectionFilter); | ||||
| validateAddedDataFiles(base, startingSnapshotId, conflictDetectionFilter, parent); | ||||
| } | ||||
|
|
||||
| if (validateNewDeleteFiles) { | ||||
| validateNoNewDeleteFiles(base, startingSnapshotId, conflictDetectionFilter); | ||||
| validateNoNewDeleteFiles(base, startingSnapshotId, conflictDetectionFilter, parent); | ||||
| } | ||||
| } | ||||
| } | ||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.