jfsii commented on code in PR #3628:
URL: https://github.com/apache/hive/pull/3628#discussion_r982970284


##########
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/serde/ParquetHiveSerDe.java:
##########
@@ -91,11 +93,61 @@ public class ParquetHiveSerDe extends AbstractSerDe 
implements SchemaInference {
 
   private ObjectInspector objInspector;
   private ParquetHiveRecord parquetRow;
+  private ObjectInspectorConverters.Converter converter;
 
   public ParquetHiveSerDe() {
     parquetRow = new ParquetHiveRecord();
   }
 
+  // Recursively check if CHAR or VARCHAR types are used
+  private boolean needsConversion(TypeInfo type) {
+    if 
(type.getTypeName().toLowerCase().startsWith(serdeConstants.CHAR_TYPE_NAME) ||
+        
type.getTypeName().toLowerCase().startsWith(serdeConstants.VARCHAR_TYPE_NAME)) {
+      return true;
+    }
+
+    if (type.getCategory().equals(Category.STRUCT)) {
+      StructTypeInfo sti = (StructTypeInfo) type;
+      for (TypeInfo t : sti.getAllStructFieldTypeInfos()) {
+        if (needsConversion(t)) {
+          return true;
+        }
+      }
+    }
+
+    if (type.getCategory().equals(Category.MAP)) {
+      TypeInfo keyTypeInfo = ((MapTypeInfo) type).getMapKeyTypeInfo();
+      if (needsConversion(keyTypeInfo)) {
+        return true;
+      }
+      TypeInfo valueTypeInfo = ((MapTypeInfo) type).getMapKeyTypeInfo();

Review Comment:
   That is correct. Thanks for catching this @kasakrisz 



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