lirui-apache commented on a change in pull request #10721: [FLINK-15429][hive] 
HiveObjectConversion implementations need to hand…
URL: https://github.com/apache/flink/pull/10721#discussion_r361970059
 
 

 ##########
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/functions/hive/conversion/HiveInspectors.java
 ##########
 @@ -146,9 +146,9 @@ public static HiveObjectConversion 
getConversion(ObjectInspector inspector, Logi
                        } else if (inspector instanceof 
TimestampObjectInspector) {
                                conversion = hiveShim::toHiveTimestamp;
                        } else if (inspector instanceof 
HiveCharObjectInspector) {
-                               conversion = o -> new HiveChar((String) o, 
((CharType) dataType).getLength());
+                               conversion = o -> o == null ? null : new 
HiveChar((String) o, ((CharType) dataType).getLength());
                        } else if (inspector instanceof 
HiveVarcharObjectInspector) {
-                               conversion = o -> new HiveVarchar((String) o, 
((VarCharType) dataType).getLength());
+                               conversion = o -> o == null ? null : new 
HiveVarchar((String) o, ((VarCharType) dataType).getLength());
                        } else if (inspector instanceof 
HiveDecimalObjectInspector) {
                                conversion = o -> o == null ? null : 
HiveDecimal.create((BigDecimal) o);
                        } else {
 
 Review comment:
   > this is because we change "getObjectInspectorForConstant" to writable hive 
type
   
   Do you mean the change in #10625? Actually even w/o #10625, this is not dead 
code because 1.1.x versions having been using writable OIs for constants.
   
   > Cna you add comments to explain?
   
   What do you think we should explain here? Please note that we may want to 
use writable OIs for both constant and non-constant in the future, as suggested 
in #10625.
   
   > And we should deal with null in WritableHiveObjectConversion too
   
   Let's leave that to #10625, since we're doing a bigger refactor there.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to