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

James Taylor commented on PHOENIX-1580:
---------------------------------------

Thanks for the WIP patch, [~ayingshu]. It's looking very good. Here's some 
feedback:
- Get rid of this syntax in the grammar file as it's not necessary and just 
complicates the grammer: (UNION)=>.
- Don't repeat the ORDER BY, LIMIT in oneStatement rule - it should rename the 
same, as the UNION stuff should be matched one level down, in 
hinted_select_node. We match the SELECT keyword outside of the rule because we 
want to allow an hint here, while not allow it for subqueries. [~maryannxue] - 
would you mind helping Alicia with this a bit? It's important that we only 
allow hints at the top level and allow UNION, ORDER BY and LIMIT only in the 
correct places as well.
{code}
 // Parses a single SQL statement (expects an EOF after the select statement).
 oneStatement returns [BindableStatement ret]
-    :   (SELECT s=hinted_select_node {$ret=s;} 
+@init{ contextStack.push(new ParseContext()); }
+    :  (s=query_expression
+        (ORDER BY order=order_by)?
+        (LIMIT l=limit)? 
+        {ParseContext context = contextStack.peek(); $ret=factory.select(s, 
order, l, getBindCount());} 
     |    ns=non_select_node {$ret=ns;}
         )
     ;
+finally{ contextStack.pop(); }
{code}
- The issue you're hitting with Parameter count not being correct may be due to 
how you're treating the list of SelectStatement and the getBindCount() passed 
in as the parameter count in each. The top level SELECT statement should govern 
the parameter count, not the inner SELECT statements.

> 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-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)

Reply via email to