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

ASF GitHub Bot commented on PHOENIX-2722:
-----------------------------------------

Github user ankitsinghal commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/154#discussion_r58504649
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java ---
    @@ -168,7 +169,11 @@ public QueryPlan compileUnionAll(SelectStatement 
select) throws SQLException {
                 SelectStatement subSelect = unionAllSelects.get(i);
                 // Push down order-by and limit into sub-selects.
                 if (!select.getOrderBy().isEmpty() || select.getLimit() != 
null) {
    -                subSelect = NODE_FACTORY.select(subSelect, 
select.getOrderBy(), select.getLimit());
    +                if (select.getOffset() == null) {
    +                    subSelect = NODE_FACTORY.select(subSelect, 
select.getOrderBy(), select.getLimit(), null);
    +                } else {
    +                    subSelect = NODE_FACTORY.select(subSelect, 
select.getOrderBy(), null, null);
    +                }
    --- End diff --
    
    Actually , In case of union , we need to apply offset at the final result 
so we can't apply limit or offset in subselect.
    but, if offset is not present , limit can be applied


> support mysql "limit,offset" clauses 
> -------------------------------------
>
>                 Key: PHOENIX-2722
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2722
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: Ankit Singhal
>            Assignee: Ankit Singhal
>            Priority: Minor
>         Attachments: PHOENIX-2722.patch, PHOENIX-2722_formatted.patch
>
>
> For serial query(query with “serial" hint or  “limit" without "order by”), we 
> can limit each scan(using page filter) to “limit+offset” instead of limit 
> earlier.
> And then, for all queries, we can forward the relevant client iterators to 
> the offset provided and then return the result.
> syntax
> {code}
> [ LIMIT { count } ]
>     [ OFFSET start [ ROW | ROWS ] ]
>     [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
> {code}
> Some new keywords(OFFSET,FETCH,ROW, ROWS,ONLY) are getting introduced so 
> users might need to see that they are not using them as column name or 
> something.
> WDYT, [~jamestaylor]



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

Reply via email to