Github user kaspersorensen commented on a diff in the pull request:

    https://github.com/apache/metamodel/pull/13#discussion_r27423309
  
    --- Diff: 
core/src/main/java/org/apache/metamodel/query/parser/SelectItemParser.java ---
    @@ -160,6 +164,14 @@ public SelectItem findSelectItem(String expression) 
throws MultipleSelectItemsPa
                     return new SelectItem(subQuerySelectItem, fromItem);
                 }
             }
    +        
    +        //if the expression is alias of some select item defined return 
clone of that select item
    +        List<SelectItem> allSelectItems = 
MetaModelHelper.getAllSelectItems(_query);
    --- End diff --
    
    Also reflecting a bit on this ... Do we need to have this 
getAllSelectItems(...) method?
    
    What I mean is, could there be aliased select items anywhere else than in 
the SELECT clause? I cannot imagine it really ... For instance in WHERE clause 
I have never seen anything a la:
    
    SELECT ... FROM ... WHERE name AS n = "Kasper"
    
    If we assume that this never happens then you can get rid of the 
getAllSelectItems(...) method which is already a bit greedy (makes new lists 
etc.). If I am wrong about the assumption (I seriously am in doubt) then I 
think the solution is good!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to