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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/type/IgniteTypeSystem.java:
##########
@@ -82,6 +86,84 @@ public int getDefaultPrecision(SqlTypeName typeName) {
         }
     }
 
+    /**
+     * Extend passed type to the nearest bigger.
+     * TINYINT -> SMALLINT
+     * SMALLINT -> INTEGER
+     * INTEGER -> BIGINT
+     * BIGINT -> DECIMAL
+     *
+     * @param typeFactory Type factory.
+     * @param type Type need to be extended.
+     * @param nullable Nullability flag.
+     * @return Extended type.
+     */
+    private static RelDataType extendType(RelDataTypeFactory typeFactory, 
RelDataType type, boolean nullable) {
+        switch (type.getSqlTypeName()) {
+            case TINYINT:
+                return 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.SMALLINT),
+                        nullable);
+            case SMALLINT:
+                return 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.INTEGER),
+                        nullable);
+            case INTEGER:
+                return 
typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.BIGINT),
+                        nullable);
+            case BIGINT:
+                return typeFactory.createTypeWithNullability(
+                        typeFactory.createSqlType(
+                                SqlTypeName.DECIMAL,
+                                
typeFactory.getTypeSystem().getMaxPrecision(SqlTypeName.DECIMAL),

Review Comment:
   I change it and some tests will fail, for example "select1.test", if it not 
"MaxPrecision(SqlTypeName.DECIMAL)" results will return with non zero scale 
"177.00000" vs "177" and it not expected, i can`t found the problem for a shot 
time, probably we need additional issue here, wdyt ?



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

Reply via email to