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

Maryann Xue commented on PHOENIX-1580:
--------------------------------------

[~aliciashu] An easy way is to use TupleProjectionPlan for queries on each 
side. TupleProjectionPlan is a DelegateQueryPlan which takes in an inner 
QueryPlan as well as a TupleProjector. You can use the RowProjector to 
construct a TupleProjector. You can refer to QueryCompiler.compileSingleQuery() 
as an example.
{code}

    protected QueryPlan compileSingleQuery(StatementContext context, 
SelectStatement select, List<Object> binds, boolean asSubquery, boolean 
allowPageFilter) throws SQLException{
        SelectStatement innerSelect = select.getInnerSelectStatement();
        if (innerSelect == null) {
            return compileSingleFlatQuery(context, select, binds, asSubquery, 
allowPageFilter, null, null, true);
        }

        QueryPlan innerPlan = compileSubquery(innerSelect);
        TupleProjector tupleProjector = new 
TupleProjector(innerPlan.getProjector());
        innerPlan = new TupleProjectionPlan(innerPlan, tupleProjector, null);
{code}

One more thing you may have to pay attention to: if the expression type of a 
certain position from one RowProjector does not match that of the corresponding 
position from the other RowProjector, type coercion is needed.

> 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: unionall-wipe.patch
>
>
> Select * from T1
> UNION ALL
> Select * from T2



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

Reply via email to