zabetak commented on code in PR #6900:
URL: https://github.com/apache/hive/pull/6900#discussion_r4326051180
##########
serde/src/java/org/apache/hadoop/hive/serde2/OpenCSVSerde.java:
##########
@@ -131,6 +132,10 @@ public Writable doSerialize(Object obj, ObjectInspector
objInspector) throws Ser
} else if (fieldOI instanceof AbstractPrimitiveWritableObjectInspector) {
Object primitiveJavaObject =
((AbstractPrimitiveWritableObjectInspector)
fieldOI).getPrimitiveJavaObject(field);
outputFields[c] = Objects.toString(primitiveJavaObject, null);
+ } else if (fieldOI instanceof AbstractPrimitiveLazyObjectInspector) {
+ Object primitiveJavaObject =
+ ((AbstractPrimitiveLazyObjectInspector<?>)
fieldOI).getPrimitiveWritableObject(field);
+ outputFields[c] = Objects.toString(primitiveJavaObject, null);
} else {
Review Comment:
The general idea I see here is to convert any primitive type to a String.
Since we have a general interface `PrimitiveObjectInspector` and the latter has
both `getPrimitiveWritableObject` and `getPrimitiveJavaObject` why not checking
for the interface and then calling one of the two methods?
Do we need to distinguish between a `StringObjectInspector`, a
`AbstractPrimitiveWritableObjectInspector`, and a
`AbstractPrimitiveLazyObjectInspector`? Aren't we risking missing cases (e.g.,
`AbstractPrimitiveJavaObjectInspector` or code breaking if other object
inspectors are added in the future?
##########
serde/src/java/org/apache/hadoop/hive/serde2/OpenCSVSerde.java:
##########
Review Comment:
There are a few other SerDe implementations implementing the `doSerialize`
method. Are the conversions happening there aligned? Is there code what we
could/should reuse?
--
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]