matriv commented on a change in pull request #18524:
URL: https://github.com/apache/flink/pull/18524#discussion_r793387424
##########
File path:
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/CastFunctionITCase.java
##########
@@ -1229,6 +1242,11 @@ private CastTestSpecBuilder fromCase(DataType dataType,
Object src, Object targe
this.columnTypes.add(dataType);
this.columnData.add(src);
this.expectedValues.add(target);
+ assertThat(
+ LogicalTypeCasts.supportsExplicitCast(
Review comment:
The formatting here, seems a bit off, but might be wrong.
##########
File path:
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/CastFunctionITCase.java
##########
@@ -1332,12 +1350,12 @@ private static boolean isTimestampToNumeric(LogicalType
srcType, LogicalType trg
return srcType.is(LogicalTypeFamily.TIMESTAMP) &&
trgType.is(LogicalTypeFamily.NUMERIC);
}
- private static <K, V> Map.Entry<K, V> entry(K k, V v) {
+ static <K, V> Map.Entry<K, V> entry(K k, V v) {
Review comment:
Maybe we can add those 2 methods in some utility class.
##########
File path:
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/CastFunctionMiscITCase.java
##########
@@ -206,7 +211,34 @@ protected Configuration configuration() {
.testSqlResult(
"CAST(CAST(x'68656C6C6F2063617374' AS
BINARY(10)) AS VARCHAR)",
"68656c6c6f2063617374",
- STRING().notNull()));
+ STRING().notNull()),
+ // Test cases that can't be added to CastFunctionITCase
because they need to
+ // workaround the limitations of fromValues
+ TestSpec.forFunction(BuiltInFunctionDefinitions.CAST, "cast
STRUCTURED to STRING")
+ .onFieldsWithData(123456, "Flink")
+ .andDataTypes(INT(), STRING())
+ .withFunction(StructuredTypeConstructor.class)
+ .testTableApiResult(
+ call("StructuredTypeConstructor", row($("f0"),
$("f1")))
+ .cast(STRING()),
+ "(i=123456, s=Flink)",
+ STRING()),
+ TestSpec.forFunction(BuiltInFunctionDefinitions.CAST, "cast
MULTISET to STRING")
+ .onFieldsWithData(map(entry("a", 1), entry("b", 1)))
Review comment:
nit: use `2` for the second entry.
--
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]