jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1416970 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SameNodeJoinConditionImpl.java oak-jcr/pom.xml
Date Tue, 04 Dec 2012 14:47:12 GMT
Author: thomasm
Date: Tue Dec  4 14:47:10 2012
New Revision: 1416970

URL: http://svn.apache.org/viewvc?rev=1416970&view=rev
Log:
OAK-475 Query tck test SameNodeJoinConditionTest failing with ParseException

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SameNodeJoinConditionImpl.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java?rev=1416970&r1=1416969&r2=1416970&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java
Tue Dec  4 14:47:10 2012
@@ -232,9 +232,8 @@ public class SQL2Parser {
                 read(",");
                 String selector2 = readName();
                 if (readIf(",")) {
-                    c = factory.sameNodeJoinCondition(selector1, selector2, readAbsolutePath());
+                    c = factory.sameNodeJoinCondition(selector1, selector2, readPath());
                 } else {
-                    // TODO verify "." is correct
                     c = factory.sameNodeJoinCondition(selector1, selector2, ".");
                 }
             } else if ("ISCHILDNODE".equalsIgnoreCase(name)) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SameNodeJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SameNodeJoinConditionImpl.java?rev=1416970&r1=1416969&r2=1416970&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SameNodeJoinConditionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SameNodeJoinConditionImpl.java
Tue Dec  4 14:47:10 2012
@@ -18,6 +18,7 @@
  */
 package org.apache.jackrabbit.oak.query.ast;
 
+import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.query.index.FilterImpl;
 import org.apache.jackrabbit.oak.spi.query.Filter;
 
@@ -68,18 +69,33 @@ public class SameNodeJoinConditionImpl e
     public boolean evaluate() {
         String p1 = selector1.currentPath();
         String p2 = selector2.currentPath();
-        return p1.equals(p2);
+        // TODO normalize paths; support more complex relative path (".." and so on)
+        if (selector2Path.equals(".")) {
+            return p1.equals(p2);
+        }
+        String p = PathUtils.concat(p2, selector2Path);
+        return p.equals(p1);
     }
 
     @Override
     public void restrict(FilterImpl f) {
         if (f.getSelector() == selector1) {
             String p2 = selector2.currentPath();
-            f.restrictPath(p2, Filter.PathRestriction.EXACT);
+            if (selector2Path.equals(".")) {
+                f.restrictPath(p2, Filter.PathRestriction.EXACT);
+            } else {
+                // TODO normalize paths; support more complex relative path (".." and so
on)
+                String p = PathUtils.concat(p2, selector2Path);
+                f.restrictPath(p, Filter.PathRestriction.EXACT);
+            }
         }
         if (f.getSelector() == selector2) {
-            String p1 = selector1.currentPath();
-            f.restrictPath(p1, Filter.PathRestriction.EXACT);
+            if (selector2Path.equals(".")) {
+                String p1 = selector1.currentPath();
+                f.restrictPath(p1, Filter.PathRestriction.EXACT);
+            } else {
+                // TODO normalize paths; support relative path (".." and so on)
+            }
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1416970&r1=1416969&r2=1416970&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Tue Dec  4 14:47:10 2012
@@ -202,12 +202,6 @@
       org.apache.jackrabbit.test.api.query.qom.ColumnTest#testExpandColumnsForNodeType  
            <!-- OAK-323 -->
       org.apache.jackrabbit.test.api.query.GetPropertyNamesTest#testGetPropertyNames    
            <!-- OAK-323 -->
       org.apache.jackrabbit.test.api.query.qom.SelectorTest#testUnknownNodeType         
            <!-- OAK-476 -->
-      org.apache.jackrabbit.test.api.query.qom.SameNodeJoinConditionTest#testInnerJoin  
            <!-- OAK-475 -->
-      org.apache.jackrabbit.test.api.query.qom.SameNodeJoinConditionTest#testRightOuterJoin
         <!-- OAK-475 -->
-      org.apache.jackrabbit.test.api.query.qom.SameNodeJoinConditionTest#testLeftOuterJoin
          <!-- OAK-475 -->
-      org.apache.jackrabbit.test.api.query.qom.SameNodeJoinConditionTest#testInnerJoinWithPath
      <!-- OAK-475 -->
-      org.apache.jackrabbit.test.api.query.qom.SameNodeJoinConditionTest#testLeftOuterJoinWithPath
  <!-- OAK-475 -->
-      org.apache.jackrabbit.test.api.query.qom.SameNodeJoinConditionTest#testRightOuterJoinWithPath
 <!-- OAK-475 -->
       org.apache.jackrabbit.test.api.observation.EventTest#testGetUserId
       org.apache.jackrabbit.test.api.observation.NodeMovedTest#testMoveNode
       org.apache.jackrabbit.test.api.observation.NodeMovedTest#testMoveTree



Mime
View raw message