Skip to content

Commit c01f0c3

Browse files
committed
Add node type to list
1 parent fd854fa commit c01f0c3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

core/src/main/java/org/apache/calcite/sql/type/OperandTypes.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)