[
https://issues.apache.org/jira/browse/FLINK-19108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Danny Chen updated FLINK-19108:
-------------------------------
Description:
For query
{code:sql}
create view tmp_view as
select * from (
select f0,
row_number() over (partition by f0 order by f0 desc) as rowNum
from source) -- the query would be aliased as "EXPR$1"
where rowNum = 1
{code}
When validation, the inner query would have alias assigned by the system with
prefix "EXPR$1", when in the `Expander`, we replace the id in the inner query
all with this prefix which is wrong because we do not add the alias to the
inner query anymore.
To solve the problem, skip the expanding of id with "EXPR$" just like how
{{SqlUtil#deriveAliasFromOrdinal}} added it.
was:
For query
{code:sql}
create view tmp_view as
select * from (
select f0,
row_number() over (partition by f0 order by f0 desc) as rowNum
from source) -- the query would be aliased as "EXPR$1"
where rowNum = 1
{code}
when validation, the inner would have query alias by the system with prefix
"EXPR$1", when in the `Expander`, we replace the id in the inner query all with
this prefix which is wrong because we do not add the alias to the inner query
anymore.
To solve the problem, skip the expanding of id with "EXPR$" just like how
{{SqlUtil#deriveAliasFromOrdinal}} added it.
> Stop expanding the identifiers with scope aliased by the system with 'EXPR$'
> prefix
> -----------------------------------------------------------------------------------
>
> Key: FLINK-19108
> URL: https://issues.apache.org/jira/browse/FLINK-19108
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / API
> Affects Versions: 1.12.0, 1.11.2
> Reporter: Danny Chen
> Priority: Major
> Fix For: 1.12.0, 1.11.2
>
>
> For query
> {code:sql}
> create view tmp_view as
> select * from (
> select f0,
> row_number() over (partition by f0 order by f0 desc) as rowNum
> from source) -- the query would be aliased as "EXPR$1"
> where rowNum = 1
> {code}
> When validation, the inner query would have alias assigned by the system with
> prefix "EXPR$1", when in the `Expander`, we replace the id in the inner query
> all with this prefix which is wrong because we do not add the alias to the
> inner query anymore.
> To solve the problem, skip the expanding of id with "EXPR$" just like how
> {{SqlUtil#deriveAliasFromOrdinal}} added it.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)