walterddr opened a new pull request #6472: [Flink-9294][Table/SQL API] Improve type inference for UDFs with composite parameter and/or result type URL: https://github.com/apache/flink/pull/6472 ## What is the purpose of the change Support more strict type checks and type inference when dealing with UDFs with composite parameter and result type. such as ``` def func1(row: Row): Row = { // ... } def func2(map: Map[String, String]): String[] = { // ... } ``` ## Brief change log - Created an `inferReturnType` interface in addition to the `getReturnType`, for which, the actual `TypeInformation[_]` will be passed in for composite parameter type check and composite return type inference. - Changed the result type inference for ScalarFunction only in this diff -> to use `inferReturnType` results first before other interfaces. - Added in more composite type unit test to illustrate cases that can be automatically inferred using `TypeExtractor`. - Added in more composite type validation test to demonstrate cases where inferReturnType can capture situations where results be produced from wrongly configured composite parameter type. ## Verifying this change - Unit tests added in `UserDefinedScalarFunctionTest` - Unit tests added in `UserDefinedFunctionValidationTest` - Integration tests added in `SqlITCase` ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): (no) - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes) - Changed ScalarFunction to add `inferReturnType` API as addition to `getReturnType` - The serializers: (no) - The runtime per-record code paths (performance sensitive): (no) - Anything that affects deployment or recovery: (no) - The S3 file system connector: (no) ## Documentation - Does this pull request introduce a new feature? (yes) - If yes, how is the feature documented? (not documented, shall be added once API is approved)
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services