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

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

Reviewing 
https://github.com/apache/calcite/pull/496/commits/3e0c7b362431ee7b1227cd547d3c494fb301743a.
 Thanks for the pull request. It's a good start, but there's quite a bit more 
to be done:
* Can you remove {{SqlConformanceEnum.setHiveCompatible}}; because it's static 
it's not thread-safe.
* Add {{SqlConformanceEnum.HIVE}} and change {{SqlConformance.isHiveCompatible}}
 to {{allowSelectTableFunction()}} (see how the fix for CALCITE-1472 added 
{{SqlConformanceEnum.SQL_SERVER_2008}} and {{SqlConformance.allowExtend()}}, 
and maybe do something similar)
* Don't to the rewrite in the parser. The parser should just parse. After 
validation has succeeded, do the rewrite in {{SqlToRelConverter}}. The idea of 
rewriting to LATERAL is still sound.
* Add some validator tests in SqlValidatorTest.java, e.g. where table function 
does not exist, or where there is a UDTF and other expressions in the SELECT 
clause.
* Hive allows [UDTF without 
AS|https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-Built-inTable-GeneratingFunctions(UDTF)]
 (e.g. {{select explode(array\[1, 2,3\]) from t}} ) and AS within parens (e.g. 
{{select explode(array\[1, 2, 3\]) as x from t}} ). We should too. Trigger the 
rewrite based on it being a UDTF, not based on the syntax.
* I get 8 test failures, including UtilTest.testResources, SqlParserTest.
* Modify documentation in reference.md
* Add at least one test that executes a SQL query and gets a result

> 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: Sihua Zhou
>              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.4.14#64029)

Reply via email to