dawidwys commented on a change in pull request #10960: [FLINK-15487][table]
Update code generation for new type inference
URL: https://github.com/apache/flink/pull/10960#discussion_r373527498
##########
File path:
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/utils/FunctionMappingExtractor.java
##########
@@ -329,15 +332,24 @@ public static SignatureExtraction
createParameterSignatureExtraction(int offset)
int offset) {
return IntStream.range(offset, method.getParameterCount())
.mapToObj(i -> {
+ // check for input group before start
extracting a data type
+ final Parameter parameter =
method.getParameters()[i];
+ final DataTypeHint hint =
parameter.getAnnotation(DataTypeHint.class);
+ if (hint != null) {
+ final DataTypeTemplate template =
DataTypeTemplate.fromAnnotation(hint, null);
+ if (template.inputGroup != null) {
+ return
FunctionArgumentTemplate.of(template.inputGroup);
+ }
+ }
+ // extract a concrete data type
final DataType type =
DataTypeExtractor.extractFromMethodParameter(typeFactory, function, method, i);
// unwrap from ARRAY data type in case of
varargs
if (method.isVarArgs() && i ==
method.getParameterCount() - 1 && type instanceof CollectionDataType) {
- return ((CollectionDataType)
type).getElementDataType();
+ return
FunctionArgumentTemplate.of(((CollectionDataType) type).getElementDataType());
} else {
- return type;
+ return
FunctionArgumentTemplate.of(type);
Review comment:
nit: two separate methods?
```
// check for input group before start extracting a data type
return tryExtractInputGroup(method, i)
// extract a concrete data type
.orElseGet(() -> extractUsingExtractor(typeFactory, function, method,
i));
```
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services