File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
core/src/main/java/org/apache/calcite/sql/type Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 1717package org .apache .calcite .sql .type ;
1818
1919import org .apache .calcite .rel .type .RelDataType ;
20+ import org .apache .calcite .sql .SqlKind ;
2021import org .apache .calcite .sql .SqlOperatorBinding ;
2122
2223import com .google .common .base .Preconditions ;
@@ -54,6 +55,14 @@ public class SqlReturnTypeInferenceChain implements SqlReturnTypeInference {
5455 for (SqlReturnTypeInference rule : rules ) {
5556 RelDataType ret = rule .inferReturnType (opBinding );
5657 if (ret != null ) {
58+ if (opBinding .getOperator ().getKind () == SqlKind .DIVIDE &&
59+ SqlTypeName .DECIMAL .equals (ret .getSqlTypeName ())) {
60+ return opBinding .getTypeFactory ().
61+ createSqlType (
62+ SqlTypeName .DECIMAL ,
63+ ret .getPrecision (),
64+ 8 );
65+ }
5766 return ret ;
5867 }
5968 }
You can’t perform that action at this time.
0 commit comments