[ 
https://issues.apache.org/jira/browse/FLINK-9294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16534424#comment-16534424
 ] 

Rong Rong commented on FLINK-9294:
----------------------------------

Thanks [~twalthr] for the heads up. Yes I think both type extractor extracts it 
as GenericTypeInfo. But I think we can use a more intelligent method to match 
functions in `UserDefinedFunctionUtils`

However, I dug a little deeper into this. seems like the actual problem was the 
mismatching of Map / Array between Scala and Java. 

For a simple function:

{code:java}
        public static class JavaFunc5 extends ScalarFunction {
                public String[] eval(Map<String, ?> map) {
                        return map.keySet().toArray(new String[0]);
                }
        }
{code}

The following SQL can find function match: `SELECT fun(a) FROM table` when 
table is a java.util.Map class. while it will fail for scala Map
Similar things happens to array as well. Will follow up with that first. 


> Improve type inference for UDFs with composite parameter or result type 
> ------------------------------------------------------------------------
>
>                 Key: FLINK-9294
>                 URL: https://issues.apache.org/jira/browse/FLINK-9294
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API &amp; SQL
>            Reporter: Rong Rong
>            Assignee: Rong Rong
>            Priority: Major
>
> Most of the UDF function signatures that includes composite types such as 
> *{{MAP}}*, *{{ARRAY}}*, etc would require user to override 
> *{{getParameterType}}* or *{{getResultType}}* method explicitly. 
> It should be able to resolve the composite type based on the function 
> signature, such as:
> {code:java}
> public String[] eval(Map<String, Integer> mapArg) { /* ...  */ }
> {code}
> should either 
> 1. Automatically resolve that:
> - *{{ObjectArrayTypeInfo<BasicTypeInfo.STRING>}}* to be the result type.
> - *{{MapTypeInfo<BasicTypeInfo.STRING, BasicTypeInfo.INTEGER>}}*  to be the 
> parameter type.
> 2. Improved function mapping to find and locate function with such signatures.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to