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

Jay Narale commented on CALCITE-5248:
-------------------------------------

[~julianhyde]  Thank you for the review.
 * Postgres and Calcite do not support aliasing in the select list and the 
where clause so most of the cases we want to test are not supported.
 * Thanks for the additional test cases, I will add those in the doc and in my 
pr. 
 * Regarding the inconsistent behavior, I agree and think we can have 2 feature 
flags, 1 for extended column aliasing which would capture the common behavior, 
and then a teradata-specific flag.
 * I will also work on having consistent error messaging as you suggested.

> Support Extended Column Aliasing
> --------------------------------
>
>                 Key: CALCITE-5248
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5248
>             Project: Calcite
>          Issue Type: New Feature
>            Reporter: Jay Narale
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Based on the discussion here [1].
> The goal is to support exteneded column aliasing in where , on clause and 
> select List. An example is Teradata [2]
> A few edge cases to be considered for proper semantics
> 1. When SubQuery( maybe table) in from and Alias have the same name eg 
> {code:java}
>  SELECT  c_customerId as c FROM ( SELECT c FROM table) WHERE c = 'test' {code}
> {code:java}
>  SELECT  trim(c_customer_name) as c FROM ( SELECT c FROM table) WHERE c = 
> 'test' {code}
> Comments 
> In a database, the execution order is *FROM > WHERE > SELECT* so the 
> semantics should be that column in the subquery is given priority and a 
> filter is  applied to that column
>  
> Some edge cases that need consideration 
> [doc|https://docs.google.com/document/d/1bt_5CmRg97gh_j_lsVrnoEDn5N3TRNGeYcyX4uGD_0g/edit]
>  
>  [1] -  [https://lists.apache.org/thread/7zk5wqgsk64903w5mbt72pwjmsftx0kz]
>  [2] - 
> [https://docs.teradata.com/r/Teradata-Database-SQL-Fundamentals/June-2017/Basic-SQL-Syntax/Referencing-Object-Names-in-a-Request/Using-a-Column-Alias]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to