rdblue commented on code in PR #4902:
URL: https://github.com/apache/iceberg/pull/4902#discussion_r884944969


##########
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/procedures/RewriteDataFilesProcedure.java:
##########
@@ -129,24 +134,34 @@ private RewriteDataFiles 
checkAndApplyFilter(RewriteDataFiles action, String whe
 
   private RewriteDataFiles checkAndApplyOptions(InternalRow args, 
RewriteDataFiles action) {
     Map<String, String> options = Maps.newHashMap();
-    args.getMap(3).foreach(DataTypes.StringType, DataTypes.StringType,
+    args.getMap(4).foreach(DataTypes.StringType, DataTypes.StringType,
             (k, v) -> {
               options.put(k.toString(), v.toString());
               return BoxedUnit.UNIT;
             });
     return action.options(options);
   }
 
-  private RewriteDataFiles checkAndApplyStrategy(RewriteDataFiles action, 
String strategy, SortOrder sortOrder) {
+  private RewriteDataFiles checkAndApplyStrategy(
+      RewriteDataFiles action,
+      String strategy,
+      SortOrder sortOrder,
+      String zOrderString) {
     // caller of this function ensures that between strategy and sortOrder, at 
least one of them is not null.
     if (strategy == null || strategy.equalsIgnoreCase("sort")) {
+      if (zOrderString != null) {
+        return action.zOrder(zOrderString.split(","));
+      }
       return action.sort(sortOrder);
     }
     if (strategy.equalsIgnoreCase("binpack")) {
       RewriteDataFiles rewriteDataFiles = action.binPack();
       if (sortOrder != null) {
         // calling below method to throw the error as user has set both 
binpack strategy and sort order
         return rewriteDataFiles.sort(sortOrder);
+      } else if (zOrderString != null) {
+        // calling below method to throw the error as user has set both 
binpack strategy and z order
+        return rewriteDataFiles.zOrder(zOrderString.split(","));

Review Comment:
   This should allow spaces, not just `,`. Can you add `trim` to the results?



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