deniskuzZ commented on code in PR #5248:
URL: https://github.com/apache/hive/pull/5248#discussion_r1638388798


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java:
##########
@@ -344,4 +364,95 @@ public static PartitionData toPartitionData(StructLike 
key, Types.StructType key
     }
     return data;
   }
+
+  public static PartitionData toPartitionData(StructLike sourceKey, 
Types.StructType sourceKeyType,
+      Types.StructType targetKeyType) {
+    PartitionData data = new PartitionData(targetKeyType);
+    for (int i = 0; i < targetKeyType.fields().size(); i++) {
+
+      int fi = i;
+      Object sourceKeyElem = sourceKeyType.fields().stream()
+          .filter(f -> 
f.name().equals(targetKeyType.fields().get(fi).name())).findFirst().get();
+
+      Object val =  
sourceKey.get(sourceKeyType.fields().indexOf(sourceKeyElem),
+          targetKeyType.fields().get(i).type().typeId().javaClass());
+      if (val != null) {
+        data.set(i, val);
+      }
+    }
+    return data;
+  }
+
+  public static Pair<List<DataFile>, List<DeleteFile>> 
getDataAndDeleteFiles(Table table, int specId,

Review Comment:
   why not to split it on 2, instead of this combined Pair<List<DataFile>, 
List<DeleteFile>>?
   are we reusing something and saving cpu cycles?



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