bowenli86 commented on a change in pull request #8769: [FLINK-12875][hive] 
support converting input args of char, varchar, bytes, timestamp, date for Hive 
functions
URL: https://github.com/apache/flink/pull/8769#discussion_r294608484
 
 

 ##########
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/functions/hive/conversion/HiveInspectors.java
 ##########
 @@ -119,9 +141,45 @@ public static HiveObjectConversion 
getConversion(ObjectInspector inspector) {
                                } else {
                                        return IdentityConversion.INSTANCE;
                                }
+                       } else if (inspector instanceof 
JavaDateObjectInspector) {
+                               if (((JavaDateObjectInspector) 
inspector).preferWritable()) {
+                                       return o -> new DateWritable((Date) o);
+                               } else {
+                                       return IdentityConversion.INSTANCE;
+                               }
+                       } else if (inspector instanceof 
JavaTimestampObjectInspector) {
+                               if (((JavaTimestampObjectInspector) 
inspector).preferWritable()) {
+                                       return o -> new 
TimestampWritable((Timestamp) o);
+                               } else {
+                                       return IdentityConversion.INSTANCE;
+                               }
+                       } else if (inspector instanceof 
JavaBinaryObjectInspector) {
+                               if (((JavaBinaryObjectInspector) 
inspector).preferWritable()) {
+                                       return o -> new BytesWritable((byte[]) 
o);
+                               } else {
+                                       return IdentityConversion.INSTANCE;
+                               }
+                       } else if (inspector instanceof 
JavaHiveCharObjectInspector) {
+                               if (((JavaHiveCharObjectInspector) 
inspector).preferWritable()) {
+                                       return o -> new HiveCharWritable(
+                                               new HiveChar((String) o, 
((CharType) dataType.getLogicalType()).getLength()));
+                               } else {
+                                       return IdentityConversion.INSTANCE;
 
 Review comment:
   You are right, I think it should be HiveChar instead

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