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


##########
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:
   Does this mean that we can always just use `writableObjectInspector`? And if 
so, then do we even need `objInspector`?
   In the else block, can we use `writableObjectInspector` if its type is same 
as `objInspector`?
   
   



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