[
https://issues.apache.org/jira/browse/FLINK-38768?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sergey Nuyanzin updated FLINK-38768:
------------------------------------
Description:
It happens only in case there is no alias for {{LATERAL TABLE}}
for instance
{code:sql}
CREATE MATERIALIZED TABLE mtbl1
AS SELECT * FROM t1, LATERAL TABLE(myFunc(b));
{code}
Then it expands query to something like
{code:sql}
SELECT `t1`.`a`, `t1`.`b`, `t1`.`c`, `t1`.`d`, `EXPR$0`.`name`, `EXPR$0`.`age`
FROM `builtin`.`default`.`t1` AS `t1`,
LATERAL TABLE(`builtin`.`default`.`myFunc`(`b`))
{code}
The problem is that it doesn't generate alias for {{LATERAL TABLE}}
It is a Calcite issue CALCITE-7312
expected expansion is
{code:sql}
SELECT `t1`.`a`, `t1`.`b`, `t1`.`c`, `t1`.`d`, `EXPR$0`.`name`, `EXPR$0`.`age`
FROM `builtin`.`default`.`t1` AS `t1`,
LATERAL TABLE(`builtin`.`default`.`myFunc`(`b`)) AS `EXPR$0`
{code}
was:
It happens only in case there is no alias for {{LATERAL TABLE}}
for instance
{code:sql}
CREATE MATERIALIZED TABLE mtbl1
AS SELECT * FROM t1, LATERAL TABLE(myFunc(b));
{code}
Then it expands query to something like
{code:sql}
SELECT `t1`.`a`, `t1`.`b`, `t1`.`c`, `t1`.`d`, `EXPR$0`.`name`, `EXPR$0`.`age`
FROM `builtin`.`default`.`t1` AS `t1`,
LATERAL TABLE(`builtin`.`default`.`myFunc`(`b`))
{code}
The problem is that it doesn't generate alias for {{LATERAL TABLE}}
It is a Calcite issue CALCITE-7312
> Materialized table fails with validation exception in case of LATERAL TABLE
> ---------------------------------------------------------------------------
>
> Key: FLINK-38768
> URL: https://issues.apache.org/jira/browse/FLINK-38768
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Reporter: Sergey Nuyanzin
> Assignee: Sergey Nuyanzin
> Priority: Major
>
> It happens only in case there is no alias for {{LATERAL TABLE}}
> for instance
> {code:sql}
> CREATE MATERIALIZED TABLE mtbl1
> AS SELECT * FROM t1, LATERAL TABLE(myFunc(b));
> {code}
> Then it expands query to something like
> {code:sql}
> SELECT `t1`.`a`, `t1`.`b`, `t1`.`c`, `t1`.`d`, `EXPR$0`.`name`, `EXPR$0`.`age`
> FROM `builtin`.`default`.`t1` AS `t1`,
> LATERAL TABLE(`builtin`.`default`.`myFunc`(`b`))
> {code}
> The problem is that it doesn't generate alias for {{LATERAL TABLE}}
> It is a Calcite issue CALCITE-7312
> expected expansion is
> {code:sql}
> SELECT `t1`.`a`, `t1`.`b`, `t1`.`c`, `t1`.`d`, `EXPR$0`.`name`, `EXPR$0`.`age`
> FROM `builtin`.`default`.`t1` AS `t1`,
> LATERAL TABLE(`builtin`.`default`.`myFunc`(`b`)) AS `EXPR$0`
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)