Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      affects version 2.3.7

      running a query that joins on the same node type against 2.3.6 returns 1 result, while running it against 2.3.7 returns the same node 3 times. if i join two different node types, i get only one result row...

      to reproduce: in my repository, i have 2 unstructured nodes with the same jcr:mimeType and one of them having the field zeronumber with value 0.

      QueryManager qm = s.getWorkspace().getQueryManager();
      Query q = qm.createQuery("SELECT data.zeronumber FROM [nt:unstructured] AS data INNER JOIN [nt:unstructured] AS second ON data.[jcr:mimeType] = second.[jcr:mimeType] WHERE data.zeronumber = 0", Query.JCR_JQOM);
      QueryResult r = q.execute();
      RowIterator i = r.getRows();
      while (i.hasNext())

      { Row n = i.nextRow(); System.out.println(n.getPath("data")); }

      jukka suspects this could be introduced by JCR-3198

      1. JCR-3219-test.patch
        3 kB
        Alex Parvulescu

        Activity

        Hide
        Jukka Zitting added a comment -

        Actually, instead of "Not A Problem" this is rather a duplicate of some other issue that already got fixed.

        Show
        Jukka Zitting added a comment - Actually, instead of "Not A Problem" this is rather a duplicate of some other issue that already got fixed.
        Hide
        Jukka Zitting added a comment -

        Reopening to adjust resolution

        Show
        Jukka Zitting added a comment - Reopening to adjust resolution
        Hide
        David Buchmann added a comment -

        indeed you are right. sorry for opening a ticket about something that got fixed

        i was confused by the semantics of joins in jcr - its not the most obvious operation (and i still don't know what the use case would be of self-joining queries).

        Show
        David Buchmann added a comment - indeed you are right. sorry for opening a ticket about something that got fixed i was confused by the semantics of joins in jcr - its not the most obvious operation (and i still don't know what the use case would be of self-joining queries).
        Hide
        Alex Parvulescu added a comment -

        hi
        are you sure it is not working properly now?

        let's look at the input data: we have data1 and data2 (data2 has the property "value").

        By doing a self inner join with no condition you'll get:
        row: data1 data1
        row: data1 data2
        row: data2 data1
        row: data2 data2

        now we'll add the condition (value = 42) =>
        row: data2 data1
        row: data2 data2

        you can check this by adding the other selector to the output:
        System.out.println("Found: "+n.getPath("data"));
        should in fact be
        System.out.println("Found: data=" + n.getPath("data") + ", second " + n.getPath("second"));

        thoughts?

        Show
        Alex Parvulescu added a comment - hi are you sure it is not working properly now ? let's look at the input data: we have data1 and data2 (data2 has the property "value"). By doing a self inner join with no condition you'll get: row: data1 data1 row: data1 data2 row: data2 data1 row: data2 data2 now we'll add the condition (value = 42) => row: data2 data1 row: data2 data2 you can check this by adding the other selector to the output: System.out.println("Found: "+n.getPath("data")); should in fact be System.out.println("Found: data=" + n.getPath("data") + ", second " + n.getPath("second")); thoughts?
        Hide
        David Buchmann added a comment - - edited

        sorry for being silent so long. i finally took the time to create a minimal example. here we go:

        this is the data i load in the repository

        <?xml version="1.0" encoding="UTF-8"?>
        <sv:node
        xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
        xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:jcr="http://www.jcp.org/jcr/1.0"
        xmlns:sv="http://www.jcp.org/jcr/sv/1.0"
        xmlns:rep="internal"

        sv:name="container"
        >
        <sv:node sv:name="data1">
        <sv:property sv:name="jcr:primaryType" sv:type="Name">
        <sv:value>nt:unstructured</sv:value>
        </sv:property>
        <sv:property sv:name="jcr:mimeType" sv:type="String">
        <sv:value>text/plain</sv:value>
        </sv:property>
        </sv:node>

        <sv:node sv:name="data2">
        <sv:property sv:name="jcr:primaryType" sv:type="Name">
        <sv:value>nt:unstructured</sv:value>
        </sv:property>
        <sv:property sv:name="jcr:mimeType" sv:type="String">
        <sv:value>text/plain</sv:value>
        </sv:property>
        <sv:property sv:name="value" sv:type="String">
        <sv:value>42</sv:value>
        </sv:property>
        </sv:node>

        </sv:node>

        and this is my java code:

        Credentials sc = new SimpleCredentials("admin","admin".toCharArray());
        Session s = repo.login(sc,workspace);

        Node root = s.getRootNode();

        NodeIterator nodes = root.getNodes();

        while (nodes.hasNext()) {
        try {
        Node n = nodes.nextNode();
        if (! "jcr:system".equals(n.getName()) && ! "rep:policy".equals(n.getName()))

        { n.remove(); }

        } catch (Exception e) {}
        }
        s.save();
        s.importXML("/", new FileInputStream("/home/david/liip/jackalope/JavaDavexClient/test.xml"), ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING);

        s.save();

        QueryManager qm = s.getWorkspace().getQueryManager();
        Query q = qm.createQuery("SELECT data.value FROM [nt:unstructured] AS data INNER JOIN [nt:unstructured] AS second ON data.[jcr:mimeType] = second.[jcr:mimeType] WHERE data.value = '42'", Query.JCR_JQOM);
        QueryResult r = q.execute();
        RowIterator i = r.getRows();
        while (i.hasNext())

        { Row n = i.nextRow(); System.out.println("Found: "+n.getPath("data")); }

        with jackrabbit 2.3.6 this outputs:

        Found: /container/data2

        with jackrabbit 2.4, this outputs:

        Found: /container/data2
        Found: /container/data2

        Show
        David Buchmann added a comment - - edited sorry for being silent so long. i finally took the time to create a minimal example. here we go: this is the data i load in the repository <?xml version="1.0" encoding="UTF-8"?> <sv:node xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:rep="internal" sv:name="container" > <sv:node sv:name="data1"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>nt:unstructured</sv:value> </sv:property> <sv:property sv:name="jcr:mimeType" sv:type="String"> <sv:value>text/plain</sv:value> </sv:property> </sv:node> <sv:node sv:name="data2"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>nt:unstructured</sv:value> </sv:property> <sv:property sv:name="jcr:mimeType" sv:type="String"> <sv:value>text/plain</sv:value> </sv:property> <sv:property sv:name="value" sv:type="String"> <sv:value>42</sv:value> </sv:property> </sv:node> </sv:node> and this is my java code: Credentials sc = new SimpleCredentials("admin","admin".toCharArray()); Session s = repo.login(sc,workspace); Node root = s.getRootNode(); NodeIterator nodes = root.getNodes(); while (nodes.hasNext()) { try { Node n = nodes.nextNode(); if (! "jcr:system".equals(n.getName()) && ! "rep:policy".equals(n.getName())) { n.remove(); } } catch (Exception e) {} } s.save(); s.importXML("/", new FileInputStream("/home/david/liip/jackalope/JavaDavexClient/test.xml"), ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING); s.save(); QueryManager qm = s.getWorkspace().getQueryManager(); Query q = qm.createQuery("SELECT data.value FROM [nt:unstructured] AS data INNER JOIN [nt:unstructured] AS second ON data. [jcr:mimeType] = second. [jcr:mimeType] WHERE data.value = '42'", Query.JCR_JQOM); QueryResult r = q.execute(); RowIterator i = r.getRows(); while (i.hasNext()) { Row n = i.nextRow(); System.out.println("Found: "+n.getPath("data")); } with jackrabbit 2.3.6 this outputs: Found: /container/data2 with jackrabbit 2.4, this outputs: Found: /container/data2 Found: /container/data2
        Hide
        Alex Parvulescu added a comment -

        I'm having some trouble reproducing this issue.
        I'm using trunk as a reference.

        I've attached a unit-test, it goes into the jackrabbit-jcr2spi module. It only logs the nodes it finds (no asserts yet), but I only see 2 nodes returned from the query, not 1 or 3.

        Can you take a look and tell me what you think?
        Maybe I missed something trying to reproduce the error.

        It is really good to submit parts of code that can illustrate what you are doing&seeing, thanks for taking the time to do that.
        In the future, I think a complete unit test will help even more with reproducing and fixing the issue.

        Show
        Alex Parvulescu added a comment - I'm having some trouble reproducing this issue. I'm using trunk as a reference. I've attached a unit-test, it goes into the jackrabbit-jcr2spi module. It only logs the nodes it finds (no asserts yet), but I only see 2 nodes returned from the query, not 1 or 3. Can you take a look and tell me what you think? Maybe I missed something trying to reproduce the error. It is really good to submit parts of code that can illustrate what you are doing&seeing, thanks for taking the time to do that. In the future, I think a complete unit test will help even more with reproducing and fixing the issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            David Buchmann
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development