What is the bug?
Currently, the syntax of JOIN command requires side aliases to be present as following
leftAlias
Syntax: left = <leftAlias>
Required
Description: The subquery alias to use with the left join side, to avoid ambiguous naming.
rightAlias
Syntax: right = <rightAlias>
Required
Description: The subquery alias to use with the right join side, to avoid ambiguous naming.
But these required side aliases could cause a bug which hide the attribute references in table.
Imaging a case as following: Assume table1, table2, and table3 all contain a column id.
select
*
from
table1 t1,
table2 t2,
table3 t3
where
t1.id = t2.id
and t1.id = t3.id
What is the bug? Currently, the syntax of JOIN command requires side aliases to be present as following
leftAlias
left = <leftAlias>
rightAlias
right = <rightAlias>
But these required side aliases could cause a bug which hide the attribute references in table. Imaging a case as following: Assume table1, table2, and table3 all contain a column
id
.The logical plan looks
To rewrite above SQL query to PPL query, we will get
The PPL query throws an exception with message:
It because the new left alias
l1
overrides the table aliast1
andt2
. Its logical plan looks