slfan1989 commented on code in PR #13962:
URL: https://github.com/apache/iceberg/pull/13962#discussion_r2317632371
##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/actions/SnapshotTableSparkAction.java:
##########
@@ -222,4 +224,22 @@ public SnapshotTableSparkAction tableLocation(String
location) {
this.destTableLocation = location;
return this;
}
+
+ private void checkLocationOverlap(String sourceTableLocation, String
icebergTableLocation) {
+ String normalizedSourceLocation = normalizePath(sourceTableLocation);
+ String normalizedIcebergLocation = normalizePath(icebergTableLocation);
+
+ Preconditions.checkArgument(
+ !normalizedIcebergLocation.startsWith(normalizedSourceLocation),
+ "The destination table location overlaps with the source table
location");
+
+ String sourceParentLocation = new
File(normalizedSourceLocation).getParent();
+ Preconditions.checkArgument(
+ !normalizedIcebergLocation.equals(normalizePath(sourceParentLocation)),
+ "The destination table location overlaps with the source table's
parent directory");
+ }
Review Comment:
Thank you for your suggestion! I believe it is reasonable, and I have made
the changes to the code based on your feedback.
--
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]