Anand,

Just a small request that if the responses others gave resolved your issue,
it would be great if you could post the resolution on your Stack Overflow
question. Thanks!

https://stackoverflow.com/questions/51994631/assign-alias-to-a-column-in-calcite-relbuilder

--
Michael Mior
mm...@apache.org



Le jeu. 23 août 2018 à 17:54, Anand Gupta <anand....@gmail.com> a écrit :

> Hi All,
>
> I am using RelBuilder to build relational expression and then converting it
> to a SQL query using Rel2SqlConverter. I skimmed through the examples of
> RelBuilder
> <
> https://github.com/apache/calcite/blob/master/core/src/test/java/org/apache/calcite/examples/RelBuilderExample.java
> >
> but
> couldn't figure out a way to assign an alias to a column name.
>
> I am able to select columns from a table and create a query like
>
> "select col1, col2, col3 from table1"
>
> However, I want to do something like
>
> "select col1 as t1, col2 as t2, col3 as n9 from table1"
>
> Ideally, there should be a way to set an alias while projecting the
> columns. However, I couldn't find it. I found two relevant methods "as" and
> "alias" in the code. However, couldn't make them work - "as" only works on
> table and "alias" refer to table name alias.
>
> Any suggestion on how to make this work will be appreciated.
>
> Thanks,
> -A
>

Reply via email to