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


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java:
##########
@@ -388,21 +388,13 @@ public static PartitionData toPartitionData(StructLike 
sourceKey, Types.StructTy
       Types.StructType targetKeyType) {
     PartitionData data = new PartitionData(targetKeyType);
     for (int i = 0; i < targetKeyType.fields().size(); i++) {
-
-      int fi = i;
-      String fieldName = targetKeyType.fields().get(fi).name();
-      Object val = sourceKeyType.fields().stream()
-          .filter(f -> f.name().equals(fieldName)).findFirst()
-          .map(sourceKeyElem -> 
sourceKey.get(sourceKeyType.fields().indexOf(sourceKeyElem),
-              targetKeyType.fields().get(fi).type().typeId().javaClass()))
-          .orElseThrow(() -> new RuntimeException(
-              String.format("Error retrieving value of partition field %s", 
fieldName)));
-
-      if (val != null) {
-        data.set(fi, val);
-      } else {
-        throw new RuntimeException(String.format("Partition field's %s value 
is null", fieldName));
-      }
+      String fieldName = targetKeyType.fields().get(i).name();

Review Comment:
   I still think would be nice to have the code refactor and new test 
committed. Please let me know if I should do this in diff PR/JIRA or we could 
change summary of the existing PR



-- 
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: gitbox-unsubscr...@hive.apache.org

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


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

Reply via email to