[jira] [Created] (FLINK-18683) Support @DataTypeHint for TableFunction output types

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-18683) Support @DataTypeHint for TableFunction output types

Shang Yuanchun (Jira)
Fabian Hueske created FLINK-18683:
-------------------------------------

             Summary: Support @DataTypeHint for TableFunction output types
                 Key: FLINK-18683
                 URL: https://issues.apache.org/jira/browse/FLINK-18683
             Project: Flink
          Issue Type: Sub-task
          Components: Table SQL / API
            Reporter: Fabian Hueske


For ScalarFunctions, the return type of an eval method can be declared with a {{@DataTypeHint}}:


{code:java}
@DataTypeHint("INT")
public Integer eval(Integer value) {
  return value * 2;
}{code}

This does not work for TableFunctions because the {{@DataTypeHint}} annotation refers to the {{void}} return type. Hence, {{TableFunction}} {{eval()}} methods must always be annotated with the more complex {{@FunctionHint}} method.
However, I think that context, it is clear that the {{@DataTypeHint}} annotation refers to the actual return type of the table function (the type parameter of {{TableFunction<OUT>}}).



We could consider allowing {{@DataTypeHint}} annotations also on {{TableFunction}} classes (defining the output type of all eval methods) and {{eval()}} methods.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)