[
https://issues.apache.org/jira/browse/PHOENIX-1580?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
James Taylor updated PHOENIX-1580:
----------------------------------
Attachment: PHOENIX-1580-grammar.patch
Here's the grammar, [~ayingshu]. Existing unit tests look good with this patch.
It's perfectly fine to ask for help, but please don't argue that code quality
and means of implementation are not important or that they are trumped by
getting new functionality in. If we don't have high standards for quality,
Phoenix will become unmaintainable and unable to move forward.
You'll need to plug in your code with this grammar. Things left to do:
- Use your select method (that takes a List<SelectStatement>) in the select
call I added in ParseNodeFactory and remove the isUnion boolean from your
SelectStatement constructor as it's not necessary.
- Implement PHOENIX-1749 as it's easy and really the only sane way to have an
ORDER BY when you have a UNION. Just change the FilterableStatement type
argument to SelectStatement in OrderByCompiler.compile(), access the
List<AliasedNode> from selectStmt.getSelects(), index into that list if the
OrderByNode.getNode() is a LiteralParseNode of type PInteger, and call accept
on that instead of the OrderByNode.getNode() on line 94 of OrderByCompiler.
- Use MergeSortTopNResultIterator instead of a ConcatResultIterator on sub
iterators if there's an ORDER BY in your UnionPlan. Otherwise, if there's a
LIMIT, surround the ConcatResultIterator with a LimitingResultIterator (see
ScanPlan for example).
- Throw a new SQLException if UNION is done inside of a subquery (but confirm
with [~maryannxue] first).
- Add more tests - test bind variables within the sub selects for example.
[~maryannxue] - do you think this will cooperate with what you helped Alicia
put together on the compile side of things? For simplicity, I pass through
hints even for subqueries, but I think they'd just be ignored (which is fine).
I pushed the ORDER BY and LIMIT into each sub select immediately by generating
a new SelectStatement. Is that going to work ok during compilation?
> Support UNION ALL
> -----------------
>
> Key: PHOENIX-1580
> URL: https://issues.apache.org/jira/browse/PHOENIX-1580
> Project: Phoenix
> Issue Type: Bug
> Reporter: Alicia Ying Shu
> Assignee: Alicia Ying Shu
> Attachments: PHOENIX-1580-grammar.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)