File tree Expand file tree Collapse file tree
core/src/main/java/org/apache/calcite/sql/type Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1570,17 +1570,20 @@ private static class MapFunctionOperandTypeChecker
15701570 private static void coerceOperands (SqlCallBinding callBinding ,
15711571 List <RelDataType > operandTypes ,
15721572 RelDataType keyType , RelDataType valueType ) {
1573+ final SqlValidator validator = callBinding .getValidator ();
15731574 final SqlCall call = callBinding .getCall ();
15741575 final List <SqlNode > operands = call .getOperandList ();
15751576 for (int i = 0 ; i < operands .size (); i ++) {
15761577 final RelDataType targetType = i % 2 == 0 ? keyType : valueType ;
15771578 if (operandTypes .get (i ).getSqlTypeName ()
15781579 != targetType .getSqlTypeName ()) {
1579- call . setOperand ( i ,
1580+ final SqlNode castNode =
15801581 SqlStdOperatorTable .CAST .createCall (SqlParserPos .ZERO ,
15811582 operands .get (i ),
15821583 SqlTypeUtil .convertTypeToSpec (targetType )
1583- .withNullable (targetType .isNullable ())));
1584+ .withNullable (targetType .isNullable ()));
1585+ call .setOperand (i , castNode );
1586+ validator .setValidatedNodeType (castNode , targetType );
15841587 }
15851588 }
15861589 }
You can’t perform that action at this time.
0 commit comments