liuyongvs commented on code in PR #25418:
URL: https://github.com/apache/flink/pull/25418#discussion_r1814179991
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/CastFunctionMiscLegacyITCase.java:
##########
@@ -51,11 +52,12 @@ Stream<TestSetSpec> getTestSetSpecs() {
BuiltInFunctionDefinitions.CAST, "legacy cast
failure returns null")
.onFieldsWithData("invalid")
.andDataTypes(STRING().notNull())
- .testSqlRuntimeError(
- "CAST(f0 AS BIGINT)",
- "Column 'EXPR$0' is NOT NULL, however, a null
value is "
- + "being written into it. You can set
job configuration "
- +
"'table.exec.sink.not-null-enforcer'='DROP' to suppress "
- + "this exception and drop such
records silently."));
+ .testSqlResult("CAST(f0 AS BIGINT)", null, BIGINT()),
+ TestSetSpec.forFunction(
+ BuiltInFunctionDefinitions.CAST, "legacy cast
failure returns null")
+ .onFieldsWithData("100")
+ .andDataTypes(STRING().notNull())
+ .testSqlResult(
+ "CAST(CAST(f0 AS DECIMAL(2, 0)) AS STRING)",
null, STRING()));
Review Comment:
it is not important, the original ScalarFunctionTests all using constant
folding
##########
flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java:
##########
@@ -545,7 +553,16 @@ protected RexNode convertCast(SqlRexContext cx, final
SqlCall call) {
type =
cx.getValidator().getValidatedNodeType(dataType.getTypeName());
}
RexNode arg = cx.convertExpression(left);
- if (arg.getType().isNullable()) {
+
+ RelOptCluster relOptCluster =
Review Comment:
added
--
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]