xuyang created CALCITE-5144:
-------------------------------

             Summary: table alias is lost by SqlToRelConverter
                 Key: CALCITE-5144
                 URL: https://issues.apache.org/jira/browse/CALCITE-5144
             Project: Calcite
          Issue Type: Improvement
          Components: core
            Reporter: xuyang


I found that in SqlToRelConverter#convertFrom, "AS" only cares about the first 
operand and just ignore the second operand, and this behavior will cause the 
information of the table alias lost.

The simple SQL is :
{code:java}
// code placeholder
select * from (select * from emp) t1 {code}
The "t1" will be lost in the final RelNode tree. I think we can retain this 
alias information in the RelNode by some way.

The real scenarios that require table aliases are Join Hint on subquery just 
like:
{code:java}
// code placeholder
SELECT /*+ USE_NL(v2) */ v2.a
FROM (select * from test1) v2 join test2 ON v2.a = test2.a {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to