In Calcite, when parsing tables with aliases, the keyword "AS" is optional.
This means that `table1 as t1` and `table1 t1` will generate the same
SqlCall.

I am not sure if you make your mapping logic after the parsing or after
RelToSql. Please note that the alias information may be lost during the
validation, planning, and toSql processes. Therefore, I advise you to make
your mapping after the SQL parsing stage.

Best,
Hongyu

On Thu, Nov 2, 2023 at 3:45 PM David Lin <davidli...@gmail.com> wrote:

> Hey there,
>
>
> I'm new to the Calcite framework and I'm trying to separate table names and
> aliases as well as  store their mapping from SQL parsing.
>
>
> When 'AS' is in play (like in Select * from table1 AS t1, table2 AS t2,
> table3), I'm good to go using SqlKind.AS in SqlCall with its two operands
> to spot table names and aliases.
>
>
> But, in a query like Select * from table1 t1, table2 t2, table3 where the
> keyword 'AS' isn't used, I'm a bit lost in figuring out the table names and
> aliases. Any tips on handling this? Thanks a bunch!
>
> -David
>

Reply via email to