Hi Community,

Currently I'm working on Calcite SQL Hint,and I want to know how to get the
table alias in al RelNode tree.

For example,consider the following sql :

select /*+ BROADCAST(a,b) */ * from nation as a left join nation as b on
a.N_REGIONKEY = b.N_REGIONKEY

The hint BROADCAST(a,b) indicates that the Shuffle type of Join uses
BROADCAST,a is left table alias,b is right table alias.

SQL corresponding to RelNode Tree is :

LogicalProject(N_NATIONKEY=[$0], N_NAME=[$1], N_REGIONKEY=[$2],
N_COMMENT=[$3], N_NATIONKEY0=[$4], N_NAME0=[$5], N_REGIONKEY0=[$6],
N_COMMENT0=[$7]) LogicalJoin(condition=[=($2, $6)], joinType=[left])
LogicalTableScan(table=[[tpch, NATION]]) LogicalTableScan(table=[[tpch,
NATION]])

I want to know what table is alias a and what table is alias b,but I can't
get the table for the aliases a and b in above RelNode tree.

In SqlToRelConverter#convertFrom method,it does not consider the alias
information of the table.

Best,
LakeShen

Reply via email to