[
https://issues.apache.org/jira/browse/CALCITE-5779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17732486#comment-17732486
]
Dmitry Sysolyatin edited comment on CALCITE-5779 at 6/14/23 10:59 AM:
----------------------------------------------------------------------
An "easy" fix is to use AliasNamespace for table functions -
https://github.com/apache/calcite/commit/9d37e75658dde72b47fc6ec122106c3767bab9bb.
However, it leads to the opposite problem:
{code}
s.withSql("select rmp from table(ramp(3)) as rmp").ok(); <-- works
s.withSql("select rmp.i from table(ramp(3)) as rmp").ok(); <-- does not work
{code}
Any idea how to properly fix this issue ?
was (Author: dmsysolyatin):
An "easy" fix to use AliasNamespace for table functions -
https://github.com/apache/calcite/commit/9d37e75658dde72b47fc6ec122106c3767bab9bb.
However, it leads to the opposite problem:
{code}
s.withSql("select rmp from table(ramp(3)) as rmp").ok(); <-- works
s.withSql("select rmp.i from table(ramp(3)) as rmp").ok(); <-- does not work
{code}
Any idea how to properly fix this issue ?
> Implicit column alias for single-column table function does not work
> --------------------------------------------------------------------
>
> Key: CALCITE-5779
> URL: https://issues.apache.org/jira/browse/CALCITE-5779
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.34.0
> Reporter: Dmitry Sysolyatin
> Priority: Major
>
> Implicit column alias for single-column table function works only for UNNEST.
> But should work for every table function.
> For example, PostgreSQL returns the same result for
> {code:java}
> SELECT i FROM UNNEST(ARRAY(1,2)) as i;
> SELECT i FROM generate_series(1,2) as i;
> i
> ---
> 1
> 2
> (2 rows)
> {code}
> But calcite throws "Column 'i' not found in any table" exception for
> {code:java}
> SELECT i FROM table(generate_series(1,2)) as i
> {code}
> Where generate_series is user defined table function.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)