You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2017/01/18 05:40:26 UTC

[jira] [Commented] (CALCITE-1581) UDTF like in hive

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

Julian Hyde commented on CALCITE-1581:
--------------------------------------

Good idea.

Let's implement this as two orthogonal features:
* Allow user-defined functions to return a record
* Allow record-valued expressions to be used in the SELECT clause with '... AS (c1, ..., cn)'

Can you give an example of an implementation of such a function? Would it be a Java method returning a class?

I'd quibble with describing this as a UDTF (user-defined table function), since each invocation returns just one record, not a set of records. It's just a UDF (user-defined function) that returns a record.

> UDTF like in hive
> -----------------
>
>                 Key: CALCITE-1581
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1581
>             Project: Calcite
>          Issue Type: New Feature
>            Reporter: Xiaoyong Deng
>            Assignee: Julian Hyde
>              Labels: udtf
>
> Support one row in and multi-column/multi-row out(one-to-many mapping), just like udtf in hive.
> The query would like this:
> {code}
> select
>   func(c0, c1) as (f0, f1, f2)
> from table_name;
> {code}
> c0 and c1 are 'table_name' columns. f0, f1 and f2 are new generated columns.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)