lowka commented on code in PR #2857:
URL: https://github.com/apache/ignite-3/pull/2857#discussion_r1410547752
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlValidator.java:
##########
@@ -440,49 +531,41 @@ public void validateAggregateParams(SqlCall aggCall,
/** {@inheritDoc} */
@Override
public RelDataType deriveType(SqlValidatorScope scope, SqlNode expr) {
- checkTypesInteroperability(scope, expr);
-
- RelDataType dataType = super.deriveType(scope, expr);
-
- // If type of dynamic parameter has not been inferred, use a type of
its value.
- RelDataType paramType = expr instanceof SqlDynamicParam
- ? getDynamicParamType((SqlDynamicParam) expr) : null;
+ if (expr instanceof SqlDynamicParam) {
+ return deriveDynamicParamType((SqlDynamicParam) expr);
+ } else {
+ checkTypesInteroperability(scope, expr);
- if (dataType.equals(unknownType) && expr instanceof SqlDynamicParam) {
- // If paramType is unknown setValidatedNodeType is a no-op.
- setValidatedNodeType(expr, paramType);
- return paramType;
- } else if (!(expr instanceof SqlCall)) {
- return dataType;
- }
+ RelDataType dataType = super.deriveType(scope, expr);
- SqlKind sqlKind = expr.getKind();
- // See the comments below.
- if (!SqlKind.BINARY_COMPARISON.contains(sqlKind)) {
- return dataType;
- }
+ SqlKind sqlKind = expr.getKind();
+ // See the comments below.
+ if (!SqlKind.BINARY_COMPARISON.contains(sqlKind)) {
+ return dataType;
+ }
- // Comparison and arithmetic operators are SqlCalls.
- SqlCall sqlCall = (SqlCall) expr;
- var lhs = getValidatedNodeType(sqlCall.operand(0));
- var rhs = getValidatedNodeType(sqlCall.operand(1));
+ // Comparison and arithmetic operators are SqlCalls.
+ SqlCall sqlCall = (SqlCall) expr;
Review Comment:
Because ` if (!SqlKind.BINARY_COMPARISON.contains(sqlKind))` does the same
thing.
--
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]