Github user kaspersorensen commented on a diff in the pull request:
https://github.com/apache/metamodel/pull/13#discussion_r27455199
--- 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 --
Well actually MetaModel's query API still does not support sub-select, so
no. But even if it did, would it make sense to have an alias in the subquery
that is then referred to in the outer query? At least then it would also be
qualified I think, a la:
SELECT ..., (SELECT name as n FROM ...) AS q FROM ... WHERE q.n = 'foo'
But to summarize: I don't think this is a scenario we need to cover at all
since only regular subqueries (in the FROM clause) is supported in MetaModel at
the moment.
---
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.
---