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

Julian Hyde commented on CALCITE-1551:
--------------------------------------

{{Frame.right}} is a list of pairs, each considered as a (key, value) pair, and 
at any point the number of pairs is equal to the number of "tables" that are in 
scope. At point 1 there is one table [e]; at point 2 and point 3 there are two 
tables [e, d], and at point 5 there is one table [x]. It's not clear how many 
tables there should be at point 4, and we should discuss.

The "key" of each pair is a table alias, and the "value" is its record type 
(i.e. the list of field names and types). For instance, at point 3, there are 
the following 2 pairs:
* key: 'e' value: {{RecordType(EMPNO INTEGER, ENAME VARCHAR, JOB VARCHAR, MGR 
INTEGER, HIREDATE DATE, SAL FLOAT, COMM FLOAT, DEPTNO INTEGER)}}
* key: 'd', value: {{RecordType(DEPTNO INTEGER, DNAME VARCHAR, LOC VARCHAR)}}

Now, back to point 4. I can see it would be useful if you can see through the 
project, and reference fields from the underlying aliases (d and e). But 
obviously you can't reference fields that have been projected away. Therefore I 
think that {{project}} should create two NEW aliases d and e with row-types 
that are subsets of the original d and e row types. What do you think?

> RelBuilder's project() doesn't preserve alias
> ---------------------------------------------
>
>                 Key: CALCITE-1551
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1551
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Jess Balint
>            Assignee: Julian Hyde
>            Priority: Minor
>
> The alias should be preserved by the project node, e.g.
> {code:java}
> .scan("EMP")
> .as("EMP_alias")
> .project(...) // resets alias to null
> .project(builder.field("EMP_alias", "DEPTNO")) // fails that no such alias 
> exists
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to