[
https://issues.apache.org/jira/browse/PHOENIX-1580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14395469#comment-14395469
]
Maryann Xue commented on PHOENIX-1580:
--------------------------------------
[~jamestaylor] Was going to either wait for the patch to stabilize and add my
fix for the subqueries, or address this in another JIRA issue. But figured I
wouldn't want to make it even messier, so just filed PHOENIX-1807.
[~ayingshu] Is there any specific reason you don't want to push the ORDER-BY
and LIMIT off to compile time as I wrote in my patch v3? Our parser is to do
the parsing job only. And it is the query-rewriter's or compiler's job to
optimize the query.
{code}
+ public SelectStatement select(List<SelectStatement> statements,
List<OrderByNode> orderBy, LimitNode limit, int bindCount, boolean isAggregate)
{
+ if (statements.size() == 1)
+ return select(statements.get(0), orderBy, limit, bindCount,
isAggregate);
+
+ boolean hasSequence = false;
+ for (int i = 0; !hasSequence && i < statements.size(); i++) {
+ hasSequence = statements.get(i).hasSequence();
+ }
+ if (orderBy != null || limit != null) {
+ // Push ORDER BY and LIMIT into sub selects and set isAggregate
correctly
+ if (orderBy == null)
+ orderBy = Collections.<OrderByNode>emptyList();
+ for (int i = 0; i < statements.size(); i++) {
+ SelectStatement statement = statements.get(i);
+ statements.set(i, SelectStatement.create(statement, orderBy,
limit, isAggregate || statement.isAggregate()));
+ }
+ }
+ return select(null, null, false, Lists.newArrayList(aliasedNode(null,
wildcard())), null, Collections.<ParseNode>emptyList(),
+ null, orderBy, limit, bindCount, false, hasSequence, statements);
+ }
{code}
> Support UNION ALL
> -----------------
>
> Key: PHOENIX-1580
> URL: https://issues.apache.org/jira/browse/PHOENIX-1580
> Project: Phoenix
> Issue Type: Improvement
> Reporter: Alicia Ying Shu
> Assignee: Alicia Ying Shu
> Attachments: PHOENIX-1580-grammar.patch, Phoenix-1580-v1.patch,
> Phoenix-1580-v2.patch, Phoenix-1580-v3.patch, Phoenix-1580-v4.patch,
> Phoenix-1580-v5.patch, Phoenix-1580-v6.patch, Phoenix-1580-v7.patch,
> Phoenix-1580-v8.patch, phoenix-1580-v1-wipe.patch, phoenix-1580.patch,
> unionall-wipe.patch
>
>
> Select * from T1
> UNION ALL
> Select * from T2
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)