korlov42 commented on code in PR #4422:
URL: https://github.com/apache/ignite-3/pull/4422#discussion_r1770887430


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeSystem.java:
##########


Review Comment:
   changes in type systems must be covered `IgniteTypeSystemTest` test



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeSystem.java:
##########
@@ -82,6 +84,144 @@ public int getDefaultPrecision(SqlTypeName typeName) {
         }
     }
 
+    /** {@inheritDoc} */
+    @Override
+    public RelDataType deriveDecimalDivideType(RelDataTypeFactory typeFactory,
+            RelDataType type1, RelDataType type2) {
+        // the only case in enlarging such a type in Number#MIN_VALUE / -1 
operation
+        if (isIntType(type1) && isIntType(type2)) {
+            boolean typesNullability = type1.isNullable() || 
type2.isNullable();
+
+            switch (type1.getSqlTypeName()) {

Review Comment:
   instead of copy-pasting all these switch cases it's better to do following:
   
   1. get least restrictive type among arguments 
(`typeFactory.leastRestrictive(List.of(type1, type2))`)
   2. get next type for the result type from p1
   



-- 
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: notifications-unsubscr...@ignite.apache.org

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

Reply via email to