snuyanzin commented on code in PR #26719:
URL: https://github.com/apache/flink/pull/26719#discussion_r2195731428
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/CollectionFunctionsITCase.java:
##########
@@ -1879,4 +1881,17 @@ private Stream<TestSetSpec> splitTestCases() {
"SPLIT(f1, '1', '2')",
"No match found for function signature
SPLIT(<CHARACTER>, <CHARACTER>, <CHARACTER>)"));
}
+
+ private Stream<TestSetSpec> arrayElementTestCases() {
+ return Stream.of(
+
TestSetSpec.forFunction(BuiltInFunctionDefinitions.ARRAY_ELEMENT)
+ .onFieldsWithData(new Integer[] {1}, new Integer[] {1,
2})
+ .andDataTypes(
+ DataTypes.ARRAY(DataTypes.INT()),
DataTypes.ARRAY(DataTypes.INT()))
+ .testResult($("f0").element(), "ELEMENT(f0)", 1,
DataTypes.INT())
+ .testSqlRuntimeError(
+ "ELEMENT(f1)",
+ TableRuntimeException.class,
+ "Array has more than one element."));
Review Comment:
great,
one last comment: can we move all the test for `element` function from
`ArrayTypeTest#testArrayOperations` here?
It would simplify future code navigation
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/CollectionFunctionsITCase.java:
##########
@@ -1879,4 +1881,17 @@ private Stream<TestSetSpec> splitTestCases() {
"SPLIT(f1, '1', '2')",
"No match found for function signature
SPLIT(<CHARACTER>, <CHARACTER>, <CHARACTER>)"));
}
+
+ private Stream<TestSetSpec> arrayElementTestCases() {
+ return Stream.of(
+
TestSetSpec.forFunction(BuiltInFunctionDefinitions.ARRAY_ELEMENT)
+ .onFieldsWithData(new Integer[] {1}, new Integer[] {1,
2})
+ .andDataTypes(
+ DataTypes.ARRAY(DataTypes.INT()),
DataTypes.ARRAY(DataTypes.INT()))
+ .testResult($("f0").element(), "ELEMENT(f0)", 1,
DataTypes.INT())
+ .testSqlRuntimeError(
+ "ELEMENT(f1)",
+ TableRuntimeException.class,
+ "Array has more than one element."));
Review Comment:
great,
one last comment: can we move all the tests for `element` function from
`ArrayTypeTest#testArrayOperations` here?
It would simplify future code navigation
--
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]