ayushtkn commented on code in PR #3438:
URL: https://github.com/apache/hive/pull/3438#discussion_r924221303


##########
serde/src/java/org/apache/hadoop/hive/serde2/OpenCSVSerde.java:
##########
@@ -115,12 +116,19 @@ public Writable serialize(Object obj, ObjectInspector 
objInspector) throws SerDe
       final Object field = outputRowOI.getStructFieldData(obj, 
outputFieldRefs.get(c));
       final ObjectInspector fieldOI = 
outputFieldRefs.get(c).getFieldObjectInspector();
 
-      // The data must be of type String
-      final StringObjectInspector fieldStringOI = (StringObjectInspector) 
fieldOI;
-
       // Convert the field to Java class String, because objects of String type
       // can be stored in String, Text, or some other classes.
-      outputFields[c] = fieldStringOI.getPrimitiveJavaObject(field);
+      if (fieldOI instanceof StringObjectInspector) {
+        outputFields[c] = ((StringObjectInspector) 
fieldOI).getPrimitiveJavaObject(field);
+      } else if (fieldOI instanceof AbstractPrimitiveWritableObjectInspector) {
+        final AbstractPrimitiveWritableObjectInspector fieldStringOI =

Review Comment:
   Do you intend to change to ``PrimitiveObjectInspector`` from 
``AbstractPrimitiveWritableObjectInspector``. I am not sure if we can do that 
PrimitiveObjectInspector has couple of child class which doesn’t implement 
toString like JavaByteObjectInspector?



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