difin commented on code in PR #6927:
URL: https://github.com/apache/hive/pull/6927#discussion_r4647144603


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/orc/VectorizedReadUtils.java:
##########
@@ -142,25 +145,29 @@ public static void handleIcebergProjection(FileScanTask 
task, JobConf job,
     PartitionSpec spec = task.spec();
     Schema currentSchema = spec.schema();
 
+    Schema readSchema = currentSchema;
     TypeDescription readOrcSchema;
     if (ORCSchemaUtil.hasIds(fileSchema)) {
       readOrcSchema = ORCSchemaUtil.buildOrcProjection(currentSchema, 
fileSchema);
     } else {
-      Schema readSchemaForOriginalFile = currentSchema;
       // In case of migrated, originally partitioned tables, partition values 
are not present in the file
       if (spec.isPartitioned()) {
-        readSchemaForOriginalFile = 
currentSchema.select(currentSchema.columns().stream()
+        readSchema = currentSchema.select(currentSchema.columns().stream()
             .filter(c -> !spec.identitySourceIds().contains(c.fieldId()))
             .map(c -> c.name())
             .collect(Collectors.toList()));
       }
 
       TypeDescription typeWithIds =
           ORCSchemaUtil.applyNameMapping(fileSchema, 
MappingUtil.create(currentSchema));
-      readOrcSchema = 
ORCSchemaUtil.buildOrcProjection(readSchemaForOriginalFile, typeWithIds);
+      readOrcSchema = ORCSchemaUtil.buildOrcProjection(readSchema, 
typeWithIds);
     }
 
-    job.set(ColumnProjectionUtils.ORC_SCHEMA_STRING, readOrcSchema.toString());
+    boolean hasUnknownType = 
TypeUtil.indexById(readSchema.asStruct()).values().stream()
+        .anyMatch(field -> field.type().typeId() == Type.TypeID.UNKNOWN);

Review Comment:
   Done, thanks. Changed it to `TypeUtil.find(readSchema, type -> type.typeId() 
== Type.TypeID.UNKNOWN) != null`. It still finds `UNKNOWN` nested in structs 
and stops at the first match.



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