nastra commented on code in PR #7900:
URL: https://github.com/apache/iceberg/pull/7900#discussion_r1246569520


##########
spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestDelete.java:
##########
@@ -1271,6 +1273,41 @@ public void 
testDeleteToWapBranchWithTableBranchIdentifier() throws NoSuchTableE
                         branch)));
   }
 
+  @Test
+  public void testDeleteToCustomWapBranchWithoutWhereClause() throws 
NoSuchTableException {
+    assumeThat(branch != null && !branch.equals(SnapshotRef.MAIN_BRANCH))

Review Comment:
   ```suggestion
       assumeThat(branch)
           .as("Run only if custom WAP branch is not main")
           .isNotNull()
           .isNotEqualTo(SnapshotRef.MAIN_BRANCH);
   ```



##########
spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/SparkTableUtil.java:
##########
@@ -666,6 +667,36 @@ public static Dataset<Row> loadMetadataTable(
         spark, DataSourceV2Relation.create(metadataTable, Some.empty(), 
Some.empty(), options));
   }
 
+  public static String wapBranch(SparkSession spark, String branch) {
+    String wapId = spark.conf().get(SparkSQLProperties.WAP_ID, null);
+    String wapBranch = spark.conf().get(SparkSQLProperties.WAP_BRANCH, null);
+    ValidationException.check(
+        wapId == null || wapBranch == null,
+        "Cannot set both WAP ID and branch, but got ID [%s] and branch [%s]",
+        wapId,
+        wapBranch);
+
+    if (wapBranch != null) {
+      ValidationException.check(
+          branch == null,
+          "Cannot write to both branch and WAP branch, but got branch [%s] and 
WAP branch [%s]",
+          branch,
+          wapBranch);
+
+      return wapBranch;
+    }
+    return branch;
+  }
+
+  public static boolean wapEnabled(Table table) {
+    return Boolean.parseBoolean(

Review Comment:
   ```suggestion
       return PropertyUtil.propertyAsBoolean(
           table.properties(),
           TableProperties.WRITE_AUDIT_PUBLISH_ENABLED,
           
Boolean.getBoolean(TableProperties.WRITE_AUDIT_PUBLISH_ENABLED_DEFAULT));
   ```



-- 
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]

Reply via email to