You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "luoyuxia (via GitHub)" <gi...@apache.org> on 2023/07/03 08:32:18 UTC
[GitHub] [flink] luoyuxia commented on a diff in pull request #22904: [FLINK-32352][table] Support type inference for procedure
luoyuxia commented on code in PR #22904:
URL: https://github.com/apache/flink/pull/22904#discussion_r1250482173
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/TypeInferenceExtractor.java:
##########
@@ -143,6 +145,27 @@ public static TypeInference forAsyncTableFunction(
return extractTypeInference(mappingExtractor);
}
+ public static TypeInference forProcedure(
+ DataTypeFactory typeFactory, Class<? extends Procedure> procedure) {
+ final ProcedureMappingExtractor mappingExtractor =
+ new ProcedureMappingExtractor(
+ typeFactory,
+ procedure,
+ ProcedureDefinition.PROCEDURE_CALL,
+ ProcedureMappingExtractor.createParameterSignatureExtraction(1),
+ ProcedureMappingExtractor.createReturnTypeResultExtraction(),
+ ProcedureMappingExtractor.createParameterAndReturnTypeVerification());
+ try {
+ return extractTypeInferenceOrError(mappingExtractor);
+ } catch (Throwable t) {
+ throw extractionError(
+ t,
+ "Could not extract a valid type inference for procedure class '%s'. "
+ + "Please check for implementation mistakes and/or provide a corresponding hint.",
+ mappingExtractor.getFunctionClass().getName());
+ }
+ }
Review Comment:
Good suggestion.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org