[ 
https://issues.apache.org/jira/browse/CALCITE-3986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17111444#comment-17111444
 ] 

Drew Schmitt commented on CALCITE-3986:
---------------------------------------

I mean that it would be nice to be able to keep aliases if they're assigned by 
the user, but to avoid rendering them in the resulting SQL if they are 
auto-generated/redundant aliases.

For example, for the following input query:
select a from abc

After parsing into an AST and unparsing to BigQuerySql results in the following 
query:
SELECT a
FROM abc AS abc

While technically correct, having the extra "AS abc" alias seems like a 
redundant/more verbose form.

> Provide config option to omit assigning an alias that is identical to its 
> identifier.
> -------------------------------------------------------------------------------------
>
>                 Key: CALCITE-3986
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3986
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Drew Schmitt
>            Priority: Minor
>
> The current alias assignment logic with the SqlValidator config option 
> identifierExpansion() set to true will eagerly try to choose an alias, even 
> if the alias name ends up being the same as the identifier itself. For 
> example, it will assign the alias "foo" for the table "foo".
> It's nice to have alias assignment, but making it identical to the identifier 
> doesn't always provide a whole lot of value and can make queries more verbose 
> than they need to be.
> Suggest we add another SqlValidator config option (defaulted to the current 
> behavior) to allow a caller to disable alias assignment in the cases that it 
> would be identical to the identifier.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to