okumin commented on code in PR #4653:
URL: https://github.com/apache/hive/pull/4653#discussion_r1370110866


##########
serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java:
##########
@@ -1263,6 +1267,33 @@ public static int compare(Object o1, ObjectInspector 
oi1, Object o2,
     }
   }
 
+  public static boolean isConversionSupported(ObjectInspector oi1, 
ObjectInspector oi2) {
+    if (oi1.getCategory() == oi2.getCategory()) {
+      if (oi1.getCategory() == Category.PRIMITIVE) {
+        PrimitiveObjectInspector poi1 = ((PrimitiveObjectInspector) oi1);
+        PrimitiveObjectInspector poi2 = ((PrimitiveObjectInspector) oi2);
+        if 
((poi1.getPrimitiveCategory().equals(PrimitiveObjectInspector.PrimitiveCategory.VARCHAR)
+            && 
poi2.getPrimitiveCategory().equals(PrimitiveObjectInspector.PrimitiveCategory.STRING))
 || (
+            
poi1.getPrimitiveCategory().equals(PrimitiveObjectInspector.PrimitiveCategory.STRING)
+                && 
poi2.getPrimitiveCategory().equals(PrimitiveObjectInspector.PrimitiveCategory.VARCHAR)))
 {
+          return true;

Review Comment:
   What's the reason why we need this? I feel this is a little risky since it 
affect several places.



##########
serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java:
##########
@@ -1263,6 +1267,33 @@ public static int compare(Object o1, ObjectInspector 
oi1, Object o2,
     }
   }
 
+  public static boolean isConversionSupported(ObjectInspector oi1, 
ObjectInspector oi2) {
+    if (oi1.getCategory() == oi2.getCategory()) {
+      if (oi1.getCategory() == Category.PRIMITIVE) {
+        PrimitiveObjectInspector poi1 = ((PrimitiveObjectInspector) oi1);
+        PrimitiveObjectInspector poi2 = ((PrimitiveObjectInspector) oi2);
+        if 
((poi1.getPrimitiveCategory().equals(PrimitiveObjectInspector.PrimitiveCategory.VARCHAR)
+            && 
poi2.getPrimitiveCategory().equals(PrimitiveObjectInspector.PrimitiveCategory.STRING))
 || (
+            
poi1.getPrimitiveCategory().equals(PrimitiveObjectInspector.PrimitiveCategory.STRING)
+                && 
poi2.getPrimitiveCategory().equals(PrimitiveObjectInspector.PrimitiveCategory.VARCHAR)))
 {
+          return true;

Review Comment:
   What's the reason why we need this? I feel this is a little risky since it 
affects several places.



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to