You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Haas, Austin" <Au...@healthsparq.com> on 2018/01/03 22:30:52 UTC

How to preserve renamed field names in final output when using RelToSqlConverter?

From this:

LogicalProject(x=[$0])
  LogicalTableScan(table=[[t]])

I get this:

"SELECT *\nFROM `t`"

But I would like to get this:

"SELECT `a` AS `x`\nFROM `t`"

How can that be achieved? Please point me in the right direction.

Please let me know if additional information is required. (Sorry for not including a complete example; I'm working in Clojure.)

Thanks!

-austin

--
Austin Haas
Clojure Developer
Austin.Haas@HealthSparq.com<ma...@HealthSparq.com>


IMPORTANT NOTICE: This communication, including any attachment, contains information that may be confidential or privileged, and is intended solely for the entity or individual to whom it is addressed.  If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message is strictly prohibited.  Nothing in this email, including any attachment, is intended to be a legally binding signature.

Re: How to preserve renamed field names in final output when using RelToSqlConverter?

Posted by Julian Hyde <jh...@apache.org>.
Also, it’s been said before but it’s worth saying again: planner rules, and RelBuilder, usually preserve field names but it’s not guaranteed.

> On Jan 3, 2018, at 6:19 PM, Julian Hyde <jh...@apache.org> wrote:
> 
> I think it’s a minor bug in SqlImplementor.isStar called from RelToSqlConverter [1]. Can you please log a JIRA case.
> 
> If you provide a PR, please also add a test to RelToSqlConverterTest.
> 
> Julian
> 
> [1] https://insight.io/github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java?line=176 <https://insight.io/github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java?line=176>
> 
>> On Jan 3, 2018, at 2:30 PM, Haas, Austin <Austin.Haas@healthsparq.com <ma...@healthsparq.com>> wrote:
>> 
>> From this:
>> 
>> LogicalProject(x=[$0])
>>  LogicalTableScan(table=[[t]])
>> 
>> I get this:
>> 
>> "SELECT *\nFROM `t`"
>> 
>> But I would like to get this:
>> 
>> "SELECT `a` AS `x`\nFROM `t`"
>> 
>> How can that be achieved? Please point me in the right direction.
>> 
>> Please let me know if additional information is required. (Sorry for not including a complete example; I'm working in Clojure.)
>> 
>> Thanks!
>> 
>> -austin
>> 
>> --
>> Austin Haas
>> Clojure Developer
>> Austin.Haas@HealthSparq.com <ma...@HealthSparq.com><mailto:Austin.Haas@HealthSparq.com <ma...@HealthSparq.com>>
>> 
>> 
>> IMPORTANT NOTICE: This communication, including any attachment, contains information that may be confidential or privileged, and is intended solely for the entity or individual to whom it is addressed.  If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message is strictly prohibited.  Nothing in this email, including any attachment, is intended to be a legally binding signature.
> 


Re: How to preserve renamed field names in final output when using RelToSqlConverter?

Posted by Julian Hyde <jh...@apache.org>.
I think it’s a minor bug in SqlImplementor.isStar called from RelToSqlConverter [1]. Can you please log a JIRA case.

If you provide a PR, please also add a test to RelToSqlConverterTest.

Julian

[1] https://insight.io/github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java?line=176 <https://insight.io/github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java?line=176>

> On Jan 3, 2018, at 2:30 PM, Haas, Austin <Au...@healthsparq.com> wrote:
> 
> From this:
> 
> LogicalProject(x=[$0])
>  LogicalTableScan(table=[[t]])
> 
> I get this:
> 
> "SELECT *\nFROM `t`"
> 
> But I would like to get this:
> 
> "SELECT `a` AS `x`\nFROM `t`"
> 
> How can that be achieved? Please point me in the right direction.
> 
> Please let me know if additional information is required. (Sorry for not including a complete example; I'm working in Clojure.)
> 
> Thanks!
> 
> -austin
> 
> --
> Austin Haas
> Clojure Developer
> Austin.Haas@HealthSparq.com<ma...@HealthSparq.com>
> 
> 
> IMPORTANT NOTICE: This communication, including any attachment, contains information that may be confidential or privileged, and is intended solely for the entity or individual to whom it is addressed.  If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message is strictly prohibited.  Nothing in this email, including any attachment, is intended to be a legally binding signature.