aokolnychyi commented on a change in pull request #4047:
URL: https://github.com/apache/iceberg/pull/4047#discussion_r807305902



##########
File path: 
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/SparkDistributionAndOrderingUtil.java
##########
@@ -171,12 +194,16 @@ private static Distribution 
buildPositionDeleteUpdateDistribution(DistributionMo
     }
   }
 
-  public static SortOrder[] buildPositionDeltaOrdering(Table table, Command 
command, Distribution distribution) {
+  public static SortOrder[] buildPositionDeltaOrdering(Table table, Command 
command) {
     // the spec requires position delete files to be sorted by file and pos
+    SortOrder[] deleteOrdering = {SPEC_ID_ORDER, PARTITION_ORDER, 
FILE_PATH_ORDER, ROW_POSITION_ORDER};
+
     if (command == DELETE || command == UPDATE) {
-      return new SortOrder[]{SPEC_ID_ORDER, PARTITION_ORDER, FILE_PATH_ORDER, 
ROW_POSITION_ORDER};
+      return deleteOrdering;
     } else {
-      throw new IllegalArgumentException("Only position deletes and updates 
are currently supported");
+      // all metadata columns like _spec_id, _file, _pos will be null for new 
data records

Review comment:
       It looks like we usually do that in switch blocks as it's required by 
the syntax. I think it should be safe enough to assume we know a finite set of 
commands.




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