twalthr commented on a change in pull request #17341:
URL: https://github.com/apache/flink/pull/17341#discussion_r717536314
##########
File path:
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/BuiltInFunctionTestBase.java
##########
@@ -383,18 +439,69 @@ public String toString() {
}
}
- private static class SqlErrorTestItem extends ErrorTestItem {
- final String expression;
+ private static class SqlErrorTestItem extends ErrorTestItem<String> {
private SqlErrorTestItem(
String expression, String errorMessage, boolean
expectedDuringValidation) {
- super(errorMessage, expectedDuringValidation);
- this.expression = expression;
+ super(expression, errorMessage, expectedDuringValidation);
+ }
+
+ @Override
+ String expression() {
+ return expression;
}
@Override
public String toString() {
return "[SQL] " + expression;
}
}
+
+ private static List<DataType> createDataTypes(
+ DataTypeFactory dataTypeFactory, AbstractDataType<?>[] dataTypes) {
+ return Stream.of(dataTypes)
+ .map(dataTypeFactory::createDataType)
+ .collect(Collectors.toList());
+ }
+
+ /** Helper POJO to store test parameters. */
+ public static class TableTestSpecColumn {
+
+ Expression tableApiExpression;
+ String sqlExpression;
+ Object result;
+ AbstractDataType<?> tableApiDataType;
+ AbstractDataType<?> sqlDataType;
+
+ public static TableTestSpecColumn of(
+ Expression tableApiExpression,
+ String sqlExpression,
+ Object result,
+ AbstractDataType<?> dataType) {
+ return of(tableApiExpression, sqlExpression, result, dataType,
dataType);
+ }
+
+ public static TableTestSpecColumn of(
+ Expression tableApiExpression,
+ String sqlExpression,
+ Object result,
+ AbstractDataType<?> tableApiDataType,
+ AbstractDataType<?> sqlQueryDataType) {
Review comment:
TBH this is a very special case and hopefully does not happen elsewhere.
we should not start having more of these special cases.
--
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]