You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2017/05/05 12:15:04 UTC

[jira] [Updated] (OAK-6116) SQL generated from xpath with 3 or more ORed paths along with order by clause throws parseException

     [ https://issues.apache.org/jira/browse/OAK-6116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Mueller updated OAK-6116:
--------------------------------
    Fix Version/s: 1.6.2

> SQL generated from xpath with 3 or more ORed paths along with order by clause throws parseException
> ---------------------------------------------------------------------------------------------------
>
>                 Key: OAK-6116
>                 URL: https://issues.apache.org/jira/browse/OAK-6116
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.6.0
>            Reporter: Vikas Saurabh
>            Assignee: Thomas Mueller
>            Priority: Critical
>              Labels: candidate_oak_1_6
>             Fix For: 1.8, 1.6.2
>
>
> With OAK-4265, we now have ability to have ORed xpath statement. Following xpath:
> {noformat}
> (/jcr:root/a//* | /jcr:root/b//* | /jcr:root/c//*) order by @jcr:score
> {noformat}
> gets transformed as
> {noformat}
> select [jcr:path], [jcr:score], *
> from [nt:base] as a
> where isdescendantnode(a, '/a')
> /* xpath: /jcr:root/a//* 
> order by @jcr:score */
> union select [jcr:path], [jcr:score], *
> from [nt:base] as a
> where isdescendantnode(a, '/b')
> /* xpath: /jcr:root/b//* 
> order by @jcr:score */
> order by [jcr:score]
> union select [jcr:path], [jcr:score], *
> from [nt:base] as a
> where isdescendantnode(a, '/c')
> /* xpath: /jcr:root/c//*
> order by @jcr:score */
> order by [jcr:score]
> {noformat}
> That SQL, although throws parse exception:
> {noformat}
> java.text.ParseException: Query: select [jcr:path], [jcr:score], *
> from [nt:base] as a
> where isdescendantnode(a, '/a')
> /* xpath: /jcr:root/a//* 
> order by @jcr:score */
> union select [jcr:path], [jcr:score], *
> from [nt:base] as a
> where isdescendantnode(a, '/b')
> /* xpath: /jcr:root/b//* 
> order by @jcr:score */
> order by [jcr:score]
> union(*)select [jcr:path], [jcr:score], *
> from [nt:base] as a
> where isdescendantnode(a, '/c')
> /* xpath: /jcr:root/c//*
> order by @jcr:score */
> order by [jcr:score]; expected: <end>
> {noformat}
> A test statement that fails (to be put in {{XPathTest}}):
> {code}
>         verify("(/jcr:root/a//* | /jcr:root/b//* | /jcr:root/c//*) order by @jcr:score",
>                 "select [jcr:path], [jcr:score], *\n" +
>                         "from [nt:base] as a\n" +
>                         "where isdescendantnode(a, '/a')\n" +
>                         "/* xpath: /jcr:root/a//* \n" +
>                         "order by @jcr:score */\n" +
>                         "union select [jcr:path], [jcr:score], *\n" +
>                         "from [nt:base] as a\n" +
>                         "where isdescendantnode(a, '/b')\n" +
>                         "/* xpath: /jcr:root/b//* \n" +
>                         "order by @jcr:score */\n" +
>                         "order by [jcr:score]\n" +
>                         "union select [jcr:path], [jcr:score], *\n" +
>                         "from [nt:base] as a\n" +
>                         "where isdescendantnode(a, '/c')\n" +
>                         "/* xpath: /jcr:root/c//*\n" +
>                         "order by @jcr:score */\n" +
>                         "order by [jcr:score]");
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)