Hi Nick, I had created a ticket for this and other types of column aliasing in https://issues.apache.org/jira/browse/CALCITE-5248 and compiled edge cases <https://docs.google.com/document/d/1bt_5CmRg97gh_j_lsVrnoEDn5N3TRNGeYcyX4uGD_0g/edit> based on Teradata's behavior. If you browse the comments, the ticket also has an unfinished patch with some remaining work in adding feature flags + tests + improvements like pushing common expressions below the project and maybe we could add snowflake's behavior too for comparison and a snowflake-specific feature flag.
On Mon, Nov 28, 2022 at 12:45 PM Nick Riasanovsky <[email protected]> wrote: > Hello Calcite developers, > > I'm working on a project using Calcite and I'm looking to support certain > SQL queries that are supported by Snowflake. Snowflake allows using > references in the same SELECT statement in which they are created, such as: > > select 1 as X, X + 2 > > My understanding is that most SQL engines will not allow this so reasonably > this is not supported by default in Calcite. However, I was wondering if > there is any existing configuration that currently supports this or if > anyone can give me some advice on how to support this. > > Thanks, > Nick Riasanovsky > -- Warm Regards, Jay Narale
