huaxingao commented on code in PR #13922:
URL: https://github.com/apache/iceberg/pull/13922#discussion_r2312256443


##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkWrite.java:
##########
@@ -222,11 +222,15 @@ private void commitOperation(SnapshotUpdate<?> operation, 
String description) {
       CommitMetadata.commitProperties().forEach(operation::set);
     }
 
-    if (wapEnabled && wapId != null) {
+    if (wapEnabled) {
       // write-audit-publish is enabled for this table and job
       // stage the changes without changing the current snapshot
-      operation.set(SnapshotSummary.STAGED_WAP_ID_PROP, wapId);
-      operation.stageOnly();
+      if (wapId != null) {
+        operation.set(SnapshotSummary.STAGED_WAP_ID_PROP, wapId);
+        operation.stageOnly();
+      } else if (writeConf.isWapBranch(branch)) {
+        operation.set(SnapshotSummary.WAP_BRANCH_PROP, branch);
+      }

Review Comment:
   can we extract the common code  into a shared helper so both 
SparkPositionDeltaWrite and SparkWriter can use the same code?



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to