Danny Chen created FLINK-19108:
----------------------------------

             Summary: 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
             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 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to