You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/09/01 10:32:09 UTC

[GitHub] [flink] aljoscha commented on a change in pull request #13149: [FLINK-18683][table-common] Support @DataTypeHint for table/aggregate function output types

aljoscha commented on a change in pull request #13149:
URL: https://github.com/apache/flink/pull/13149#discussion_r481038836



##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/extraction/TypeInferenceExtractorTest.java
##########
@@ -861,4 +907,32 @@ public Number eval(Number n) {
 			return n;
 		}
 	}
+
+	@DataTypeHint("ROW<i INT>")
+	private static class DataTypeHintOnTableFunction extends TableFunction<Row> {

Review comment:
       Just a nit, but this could be `DataTypeHintOnTableFunctionClass` and the next one could be ``DataTypeHintOnTableFunctionMethod`. 

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/FunctionTemplate.java
##########
@@ -74,6 +74,28 @@ static FunctionTemplate fromAnnotation(DataTypeFactory typeFactory, FunctionHint
 		);
 	}
 
+	/**

Review comment:
       This is just moving the code, no other changes, right?

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/FunctionMappingExtractor.java
##########
@@ -437,9 +440,30 @@ static ResultExtraction createReturnTypeResultExtraction() {
 
 	/**
 	 * Extraction that uses a generic type variable for producing a {@link FunctionResultTemplate}.
+	 *
+	 * <p>If enabled, a {@link DataTypeHint} from method or class has higher priority.
 	 */
-	static ResultExtraction createGenericResultExtraction(Class<? extends UserDefinedFunction> baseClass, int genericPos) {
+	static ResultExtraction createGenericResultExtraction(
+			Class<? extends UserDefinedFunction> baseClass,
+			int genericPos,
+			boolean allowDataTypeHint) {

Review comment:
       Why do we need the switch (`allowDataTypeHint`) here? Is it only to avoid rewriting tests?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org