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


##########
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:
   I don't know much about this tbh (I will have to look into this in detail), 
but do you think it's a better solution to somehow pass the correct 
`objInspector` to this method?
   Because what it looks like is we are calling the `serialize` method and 
asking it to use a particular inspector. And then, with this patch, we may not 
even use that inspector.



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