lgbo-ustc commented on code in PR #9536:
URL: https://github.com/apache/incubator-gluten/pull/9536#discussion_r2099122275


##########
gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/Utils.java:
##########
@@ -46,4 +56,42 @@ public static void registerRegistry() {
             ISerializableRegistry.registerAll();
         }
     }
+
+    private static final List<Type> NUMBER_TYPE_PRIORITY_LIST = List.of(
+        new TinyIntType(),
+        new SmallIntType(),
+        new IntegerType(),
+        new BigIntType(),
+        new RealType(),
+        new DoubleType()
+    );
+
+    private static int getNumberTypePriority(Type type) {
+        int index = -1;
+        for (int i = 0; i < NUMBER_TYPE_PRIORITY_LIST.size(); ++i) {
+            if 
(NUMBER_TYPE_PRIORITY_LIST.get(i).getClass().equals((type.getClass()))) {
+                index = i;
+                break;
+            }
+        }
+        if (index == -1) {

Review Comment:
   done



##########
gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/Utils.java:
##########
@@ -46,4 +56,42 @@ public static void registerRegistry() {
             ISerializableRegistry.registerAll();
         }
     }
+
+    private static final List<Type> NUMBER_TYPE_PRIORITY_LIST = List.of(
+        new TinyIntType(),
+        new SmallIntType(),
+        new IntegerType(),
+        new BigIntType(),
+        new RealType(),
+        new DoubleType()
+    );
+
+    private static int getNumberTypePriority(Type type) {
+        int index = -1;
+        for (int i = 0; i < NUMBER_TYPE_PRIORITY_LIST.size(); ++i) {
+            if 
(NUMBER_TYPE_PRIORITY_LIST.get(i).getClass().equals((type.getClass()))) {
+                index = i;
+                break;
+            }
+        }
+        if (index == -1) {
+            throw new RuntimeException("Unsupported type: " + 
type.getClass().getName());
+        }
+        return index;
+    }
+
+    public static List<TypedExpr> 
promoteTypeForNumberExpressions(List<TypedExpr> expressions) {

Review Comment:
   done



##########
gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/Utils.java:
##########
@@ -46,4 +56,42 @@ public static void registerRegistry() {
             ISerializableRegistry.registerAll();
         }
     }
+
+    private static final List<Type> NUMBER_TYPE_PRIORITY_LIST = List.of(
+        new TinyIntType(),
+        new SmallIntType(),
+        new IntegerType(),
+        new BigIntType(),
+        new RealType(),
+        new DoubleType()

Review Comment:
   done



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

Reply via email to