szehon-ho commented on a change in pull request #2925:
URL: https://github.com/apache/iceberg/pull/2925#discussion_r803225691
##########
File path: api/src/main/java/org/apache/iceberg/ReplacePartitions.java
##########
@@ -49,4 +55,42 @@
* @return this for method chaining
*/
ReplacePartitions validateAppendOnly();
+
+ /**
+ * Set the snapshot ID used in validations for this operation.
+ *
+ * All validations will check changes after this snapshot ID. If this is not
called, validation will occur
+ * from the current snapshot ID upon creation of this object.
+ *
+ * This method should be called before this operation is committed.
+ * If a concurrent operation committed a data file or row delta after the
given snapshot ID
+ * that might contain rows matching a partition marked for deletion,
validation will detect this and fail.
+ *
+ * @param snapshotId a snapshot ID, it should be set to when this operation
started to read the table.
+ * @return this for method chaining
+ */
+ ReplacePartitions validateFromSnapshot(long snapshotId);
+
+
Review comment:
Done
##########
File path: api/src/main/java/org/apache/iceberg/ReplacePartitions.java
##########
@@ -20,19 +20,25 @@
package org.apache.iceberg;
/**
- * Not recommended: API for overwriting files in a table by partition.
+ * API for overwriting files in a table by partition.
* <p>
* This is provided to implement SQL compatible with Hive table operations but
is not recommended.
* Instead, use the {@link OverwriteFiles overwrite API} to explicitly
overwrite data.
* <p>
+ * The default validation mode is idempotent, meaning the overwrite is
+ * correct and should be committed out regardless of other concurrent changes
to the table.
+ * Alternatively, this API can be configured to validate that no new data or
deletes
+ * have been applied since a snapshot ID associated when this operation began.
+ * This can be done by calling {@link #validateNoConflictingDeletes()}
+ * and {@link #validateNoConflictingData()}, and will ensure that no
conflicting delta files or data files
Review comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]