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

Thomas Mueller commented on OAK-7131:
-------------------------------------

[~catholicon] I don't see a case where order for sub-statements (sub-queries of 
a union) should be different than the order of the union. In theory it's 
possible to have different orders, but I don't think we have that case now: 
assuming the user wants to order by x, y, and x needs to be in (1, 2), then we 
could rewrite as follows:

{noformat}
(select * from ... where x = 1 order by y)
union all
(select * from ... where x = 2 order by y)
order by x, y
{noformat}

> xpath to sql2 conversion drops order by clause for some cases
> -------------------------------------------------------------
>
>                 Key: OAK-7131
>                 URL: https://issues.apache.org/jira/browse/OAK-7131
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: query
>            Reporter: Vikas Saurabh
>            Assignee: Thomas Mueller
>            Priority: Critical
>             Fix For: 1.10
>
>
> When xpath has OR-ed primary type and a couple of OR-ed property constraint 
> (e.g. \[0]), the converted sql statement doesn't get ordering clause.
> \[0]:
> {noformat}
> //(element(*, type1) | element(*, type2))[@a='b' or @c='d'] order by @foo
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to