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: [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]