-
Notifications
You must be signed in to change notification settings - Fork 1.9k
IGNITE-28801 Calcite. Bump calcite dependency version to 1.42 #13274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5095dd0
15fa38b
11eb43e
01667f9
2d7e595
70469e3
c608397
d80198e
e9ecff7
c68a2a1
246e564
3695e26
1d9f67e
2df7bc3
a519e07
7184e60
d72cc0b
8735dac
d873b13
58b3fc2
a31c88c
31148f2
fc84290
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -387,6 +387,7 @@ data: { | |
| "UESCAPE" | ||
| "UNIQUE" | ||
| "UNKNOWN" | ||
| "UNSIGNED" | ||
| "UPPER" | ||
| "UPSERT" | ||
| "UUID" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,16 +78,21 @@ | |
| import static java.util.Objects.requireNonNull; | ||
| import static org.apache.calcite.adapter.enumerable.EnumUtils.generateCollatorExpression; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.Add; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.AddChecked; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.Divide; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.DivideChecked; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.Equal; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.GreaterThan; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.GreaterThanOrEqual; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.LessThan; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.LessThanOrEqual; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.Multiply; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.MultiplyChecked; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.Negate; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.NegateChecked; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.NotEqual; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.Subtract; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.SubtractChecked; | ||
| import static org.apache.calcite.linq4j.tree.ExpressionType.UnaryPlus; | ||
| import static org.apache.calcite.sql.fun.SqlLibraryOperators.ACOSH; | ||
| import static org.apache.calcite.sql.fun.SqlLibraryOperators.ASINH; | ||
|
|
@@ -162,6 +167,7 @@ | |
| import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CEIL; | ||
| import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CHAR_LENGTH; | ||
| import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CHECKED_DIVIDE; | ||
| import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CHECKED_DIVIDE_INTEGER; | ||
| import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CHECKED_MINUS; | ||
| import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CHECKED_MULTIPLY; | ||
| import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CHECKED_PLUS; | ||
|
|
@@ -344,6 +350,13 @@ public class RexImpTable { | |
| defineUnary(UNARY_MINUS, Negate, NullPolicy.STRICT, | ||
| BuiltInMethod.BIG_DECIMAL_NEGATE.getMethodName()); | ||
| defineUnary(UNARY_PLUS, UnaryPlus, NullPolicy.STRICT, null); | ||
| // checked arithmetic | ||
| defineBinary(CHECKED_PLUS, AddChecked, NullPolicy.STRICT, "checkedPlus"); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. due to categorical CHECED type without conformance flag check |
||
| defineBinary(CHECKED_MINUS, SubtractChecked, NullPolicy.STRICT, "checkedMinus"); | ||
| defineBinary(CHECKED_MULTIPLY, MultiplyChecked, NullPolicy.STRICT, "checkedMultiply"); | ||
| defineBinary(CHECKED_DIVIDE, DivideChecked, NullPolicy.STRICT, "checkedDivide"); | ||
| defineBinary(CHECKED_DIVIDE_INTEGER, DivideChecked, NullPolicy.STRICT, "checkedDivide"); | ||
| defineUnary(CHECKED_UNARY_MINUS, NegateChecked, NullPolicy.STRICT, "checkedUnaryMinus"); | ||
|
|
||
| defineMethod(MOD, "mod", NullPolicy.STRICT); | ||
| defineMethod(EXP, "exp", NullPolicy.STRICT); | ||
|
|
@@ -1227,7 +1240,7 @@ private static class BinaryImplementor extends AbstractRexCallImplementor { | |
| @Override Expression implementSafe( | ||
| final RexToLixTranslator translator, | ||
| final RexCall call, | ||
| final List<Expression> argValueList) { | ||
| List<Expression> argValueList) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like it still final, why final was removed?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, it`s not a final on apache calcite |
||
| // neither nullable: | ||
| // return x OP y | ||
| // x nullable | ||
|
|
@@ -1243,7 +1256,7 @@ private static class BinaryImplementor extends AbstractRexCallImplementor { | |
| // If one or both operands have ANY type, use the late-binding backup | ||
| // method. | ||
| if (anyAnyOperands(call)) | ||
| return callBackupMethodAnyType(translator, call, argValueList); | ||
| return callBackupMethodAnyType(argValueList); | ||
|
|
||
| final Type type0 = argValueList.get(0).getType(); | ||
| final Type type1 = argValueList.get(1).getType(); | ||
|
|
@@ -1272,10 +1285,6 @@ private static class BinaryImplementor extends AbstractRexCallImplementor { | |
| argValueList); | ||
| } | ||
|
|
||
| // For checked arithmetic call the method. | ||
| if (CHECKED_OPERATORS.contains(op)) | ||
| return Expressions.call(SqlFunctions.class, backupMethodName, argValueList); | ||
|
|
||
| return IgniteExpressions.makeBinary(expressionType, | ||
| argValueList.get(0), argValueList.get(1)); | ||
| } | ||
|
|
@@ -1290,8 +1299,7 @@ private boolean anyAnyOperands(RexCall call) { | |
| } | ||
|
|
||
| /** */ | ||
| private Expression callBackupMethodAnyType(RexToLixTranslator translator, | ||
| RexCall call, List<Expression> expressions) { | ||
| private Expression callBackupMethodAnyType(List<Expression> expressions) { | ||
| final String backupMethodNameForAnyType = | ||
| backupMethodName + METHOD_POSTFIX_FOR_ANY_TYPE; | ||
|
|
||
|
|
@@ -1343,6 +1351,8 @@ private static class UnaryImplementor extends AbstractRexCallImplementor { | |
| if (expressionType == ExpressionType.Negate && argVal.type == BigDecimal.class | ||
| && null != backupMethodName) | ||
| e = Expressions.call(argVal, backupMethodName); | ||
| else if (expressionType == NegateChecked && null != backupMethodName) | ||
| e = Expressions.call(SqlFunctions.class, backupMethodName, argValueList); | ||
| else | ||
| e = IgniteExpressions.makeUnary(expressionType, argVal); | ||
|
|
||
|
|
@@ -1565,9 +1575,12 @@ private static class CastImplementor extends AbstractRexCallImplementor { | |
| assert call.getOperands().size() == 1; | ||
| final RelDataType srcType = call.getOperands().get(0).getType(); | ||
|
|
||
| // Short-circuit if no cast is required | ||
| RexNode arg = call.getOperands().get(0); | ||
| if (call.getType().equals(srcType)) { | ||
|
|
||
| // Short-circuit if no cast is required | ||
| if (call.getType().equals(srcType) | ||
| // However, do not elide casts to decimal types, they perform bounds checking | ||
| && srcType.getSqlTypeName() != SqlTypeName.DECIMAL) { | ||
| // No cast required, omit cast | ||
| return argValueList.get(0); | ||
| } | ||
|
|
@@ -1588,10 +1601,10 @@ private static class CastImplementor extends AbstractRexCallImplementor { | |
| private RelDataType nullifyType(JavaTypeFactory typeFactory, | ||
| final RelDataType type, final boolean nullable) { | ||
| if (type instanceof RelDataTypeFactoryImpl.JavaType) { | ||
| final Primitive primitive = Primitive.ofBox( | ||
| ((RelDataTypeFactoryImpl.JavaType)type).getJavaClass()); | ||
| if (primitive != null) | ||
| return typeFactory.createJavaType(primitive.primitiveClass); | ||
| Class<?> javaCls = ((RelDataTypeFactoryImpl.JavaType)type).getJavaClass(); | ||
| final Class<?> primitive = Primitive.unbox(javaCls); | ||
| if (primitive != javaCls) | ||
| return typeFactory.createJavaType(primitive); | ||
| } | ||
| return typeFactory.createTypeWithNullability(type, nullable); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check comment near, due to
https://issues.apache.org/jira/browse/CALCITE-7443