thomasrebele commented on code in PR #6229:
URL: https://github.com/apache/hive/pull/6229#discussion_r2609789091


##########
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/serde/ParquetHiveSerDe.java:
##########
@@ -143,7 +147,14 @@ public Writable serialize(final Object obj, final 
ObjectInspector objInspector)
     }
 
     parquetRow.value = obj;
-    parquetRow.inspector= (StructObjectInspector)objInspector;
+    // The 'objInspector' coming from Operator may have different type infos 
than table column type infos which will lead to the issues like HIVE-26877
+    // so comparing the object inspector created during initialize phase of 
this SerDe class and the object inspector coming from Operator
+    // if they are different then using the object inspector created during 
initialize phase which is proper
+    if (!ObjectInspectorUtils.compareTypes(writableObjectInspector, 
objInspector)) {
+      parquetRow.inspector = (StructObjectInspector) writableObjectInspector;
+    } else {
+      parquetRow.inspector = (StructObjectInspector) objInspector;
+    }

Review Comment:
   Indeed, it would be better for the performance to change the `initialize` 
method so that it sets the `objInspector` to the one that's actually used.



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