Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2297

NodeIterator failing to deliver next Node when using EXCEPT / INTERSECT / UNION

XMLWordPrintable

    If I fire the query below and then loop over the resultset using NodeIterator.hasnext() / NodeIterator.nextNode(), I get a java.util.NoSuchElementException at org.modeshape.jcr.query.NodeSequence$SingleWidthBatch.getNode(NodeSequence.java:1979)
    at org.modeshape.jcr.query.JcrQueryResult$QueryResultNodeIterator.nextNode(JcrQueryResult.java:292)

    Edit: same happens if using UNION, INTERSECT works in this case but only because it returns an empty resultset. So I guess it always happens on non empty set

    Code used to loop:

    NodeIterator nodeIterator = query.execute().getNodes()
    while (nodeIterator.hasNext()) {
                  nodeIterator.nextNode();
                }
    

    Query code:

    SELECT BASE.* from [nt:unstructured] as BASE  
    
    JOIN  [nt:unstructured] AS REF ON ISCHILDNODE(BASE,REF) 
    JOIN [nt:unstructured] AS REF2 ON REF2.[jcr:uuid] = REF.[jcr:uuid] 
    
    
    INTERSECT
    
    SELECT BASE.* from [nt:unstructured] as BASE  
    JOIN  [nt:unstructured] AS REF 
    	ON REF.[jcr:uuid] = BASE.[jcr:uuid]
    

            rhauch Randall Hauch (Inactive)
            bes82 Bjoern Schmidt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: