You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Alex Parvulescu (JIRA)" <ji...@apache.org> on 2011/03/31 12:56:05 UTC

[jira] [Updated] (JCR-2933) SQL2 Left Outer Join

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

Alex Parvulescu updated JCR-2933:
---------------------------------

    Attachment: JCR-2933.patch

Attached patch + test that replicates the indicated (and hopefully fixed ;) problem.

The solution consists of:

 - in the case where there is an Outer Join with a 'WHERE' condition, we'll run 2 queries in lucene, one that has only the 'ON' condition from the join, and the other one that has 'ON' and 'WHERE'.
This way it is easy to distinguish between a 'null' row and a row that must not be included in the result set.

I haven't tested in other scenarios than a 2 way Outer Join, this is also indicated by the test.

If you feel that there are corner cases that are not covered, please let me now, or even better submit a patch to the test, this way we can keep track of these things.



> SQL2 Left Outer Join
> --------------------
>
>                 Key: JCR-2933
>                 URL: https://issues.apache.org/jira/browse/JCR-2933
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.2.4
>            Reporter: Manfred Sattler
>            Assignee: Jukka Zitting
>         Attachments: JCR-2933.patch
>
>
> Create this nodes.
> def n1 = root.addNode("node1", "sling:SamplePage");
> n1.setProperty("n1prop1", "page1");
> def n2 = n1.addNode("node2", "sling:SampleContent");
> n2.setProperty("n2prop1", "content1");
> Execute this Query:
> Select * from [sling:SamplePage] as page left outer join [sling:SampleContent] as content on ISDESCENDANTNODE(content,page) where page.n1prop1 = 'page1' and content.n2prop1 = 'content1';
> The resultset have 1 row with 2 Nodes. This OK.
> Then execute this:
> Select * from [sling:SamplePage] as page left outer join [sling:SampleContent] as content on ISDESCENDANTNODE(content,page) where page.n1prop1 = 'page1' and content.n2prop1 = 'XXXXX';
> The resultset has 1 row with 1 node.
> This wrong. The result should be 0 rows.
> Old Versions, prior 2.2.2 have also 0 rows as result.
> Also, if nodes "n2" not exists, jackrabbit reports 1 row as result.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira