jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1387630 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/query/ main/java/org/apache/jackrabbit/oak/query/ast/ test/java/org/apache/jackrabbit/oak/query/ test/resources/org/apache/jackrabbit/oak/query/
Date Wed, 19 Sep 2012 15:02:36 GMT
Author: thomasm
Date: Wed Sep 19 15:02:35 2012
New Revision: 1387630

URL: http://svn.apache.org/viewvc?rev=1387630&view=rev
Log:
OAK-28 Query implementation: clean up quoting in query plans, use constants for jcr:path and jcr:score, remove unused methods, upper(x) / lower(x) / length(x) implies x is not null

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
    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/XPathToSQL2Converter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AstElement.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ChildNodeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ChildNodeJoinConditionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DescendantNodeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DescendantNodeJoinConditionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DynamicOperandImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/EquiJoinConditionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchScoreImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/JoinImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LowerCaseImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeLocalNameImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/OrderingImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyExistenceImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SameNodeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SameNodeJoinConditionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SourceImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/UpperCaseImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java Wed Sep 19 15:02:35 2012
@@ -21,7 +21,9 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+
 import javax.jcr.PropertyType;
+
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.CoreValue;
@@ -65,6 +67,17 @@ import org.apache.jackrabbit.oak.spi.sta
  * re-executed, a new instance is created.
  */
 public class Query {
+    
+    /**
+     * The "jcr:path" pseudo-property.
+     */
+    // TODO jcr:path isn't an official feature, support it?
+    public static final String JCR_PATH = "jcr:path";
+
+    /**
+     * The "jcr:score" pseudo-property.
+     */
+    public static final String JCR_SCORE = "jcr:score";
 
     final SourceImpl source;
     final ConstraintImpl constraint;

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=1387630&r1=1387629&r2=1387630&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 Wed Sep 19 15:02:35 2012
@@ -118,8 +118,8 @@ public class SQL2Parser {
         read("SELECT");
         ArrayList<ColumnOrWildcard> list = parseColumns();
         if (supportSQL1) {
-            addColumnIfNecessary(list, "jcr:path", "jcr:path");
-            addColumnIfNecessary(list, "jcr:score", "jcr:score");
+            addColumnIfNecessary(list, Query.JCR_PATH, Query.JCR_PATH);
+            addColumnIfNecessary(list, Query.JCR_SCORE, Query.JCR_SCORE);
         }
         read("FROM");
         SourceImpl source = parseSource();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/XPathToSQL2Converter.java Wed Sep 19 15:02:35 2012
@@ -273,14 +273,14 @@ public class XPathToSQL2Converter {
         
         // select ...
         buff.append("select ");
-        buff.append(new Property(currentSelector, "jcr:path").toString());
+        buff.append(new Property(currentSelector, Query.JCR_PATH).toString());
         if (selectors.size() > 1) {
-            buff.append(" as [jcr:path]");
+            buff.append(" as ").append('[').append(Query.JCR_PATH).append(']');
         }
         buff.append(", ");
-        buff.append(new Property(currentSelector, "jcr:score").toString());
+        buff.append(new Property(currentSelector, Query.JCR_SCORE).toString());
         if (selectors.size() > 1) {
-            buff.append(" as [jcr:score]");
+            buff.append(" as ").append('[').append(Query.JCR_SCORE).append(']');
         }
         if (columnList.isEmpty()) {
             buff.append(", ");

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AstElement.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AstElement.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AstElement.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AstElement.java Wed Sep 19 15:02:35 2012
@@ -39,8 +39,8 @@ abstract class AstElement {
         }
     }
 
-    protected String quotePath(String path) {
-        return '[' + path + ']';
+    protected String quote(String pathOrName) {
+        return '[' + pathOrName + ']';
     }
 
     public void setQuery(Query query) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ChildNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ChildNodeImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ChildNodeImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ChildNodeImpl.java Wed Sep 19 15:02:35 2012
@@ -36,14 +36,6 @@ public class ChildNodeImpl extends Const
         this.parentPath = parentPath;
     }
 
-    public String getSelectorName() {
-        return selectorName;
-    }
-
-    public String getParentPath() {
-        return parentPath;
-    }
-
     @Override
     boolean accept(AstVisitor v) {
         return v.visit(this);
@@ -51,7 +43,7 @@ public class ChildNodeImpl extends Const
 
     @Override
     public String toString() {
-        return "ischildnode(" + selectorName + ", " + quotePath(parentPath) + ')';
+        return "ischildnode(" + quote(selectorName) + ", " + quote(parentPath) + ')';
     }
 
     public void bindSelector(SourceImpl source) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ChildNodeJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ChildNodeJoinConditionImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ChildNodeJoinConditionImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ChildNodeJoinConditionImpl.java Wed Sep 19 15:02:35 2012
@@ -37,14 +37,6 @@ public class ChildNodeJoinConditionImpl 
         this.parentSelectorName = parentSelectorName;
     }
 
-    public String getChildSelectorName() {
-        return childSelectorName;
-    }
-
-    public String getParentSelectorName() {
-        return parentSelectorName;
-    }
-
     @Override
     boolean accept(AstVisitor v) {
         return v.visit(this);
@@ -52,9 +44,8 @@ public class ChildNodeJoinConditionImpl 
 
     @Override
     public String toString() {
-        String child = getChildSelectorName();
-        String parent = getParentSelectorName();
-        return "ischildnode(" + child + ", " + parent + ')';
+        return "ischildnode(" + quote(childSelectorName) + 
+                ", " + quote(parentSelectorName) + ')';
     }
 
     public void bindSelector(SourceImpl source) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ColumnImpl.java Wed Sep 19 15:02:35 2012
@@ -21,6 +21,7 @@ package org.apache.jackrabbit.oak.query.
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.query.Query;
 
 /**
  * A result column expression.
@@ -35,19 +36,11 @@ public class ColumnImpl extends AstEleme
         this.propertyName = propertyName;
         this.columnName = columnName;
     }
-
+    
     public String getColumnName() {
         return columnName;
     }
 
-    public String getPropertyName() {
-        return propertyName;
-    }
-
-    public String getSelectorName() {
-        return selectorName;
-    }
-
     @Override
     boolean accept(AstVisitor v) {
         return v.visit(this);
@@ -56,10 +49,10 @@ public class ColumnImpl extends AstEleme
     @Override
     public String toString() {
         if (propertyName != null) {
-            return getSelectorName() + '.' + getPropertyName()
-                    + " as [" + columnName + "]";
+            return quote(selectorName) + '.' + quote(propertyName) + 
+                    " as " + quote(columnName);
         } else {
-            return getSelectorName() + ".*";
+            return quote(selectorName) + ".*";
         }
     }
 
@@ -71,7 +64,7 @@ public class ColumnImpl extends AstEleme
                 return null;
             }
             CoreValue v = query.getValueFactory().createValue(p);
-            return new SinglePropertyState(SelectorImpl.PATH, v);
+            return new SinglePropertyState(Query.JCR_PATH, v);
         }
         return selector.currentProperty(propertyName);
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java Wed Sep 19 15:02:35 2012
@@ -62,7 +62,8 @@ public class ComparisonImpl extends Cons
         // "operand2 always evaluates to a scalar value"
         CoreValue v2 = operand2.currentValue();
         if (v2 == null) {
-            // TODO comparison: what about (null <> x) ?
+            // if the property doesn't exist, the result is always false
+            // even for "null <> 'x'" (same as in SQL) 
             return false;
         }
         boolean isArray = p1.isArray();
@@ -138,14 +139,14 @@ public class ComparisonImpl extends Cons
                 } else if (operand1.supportsRangeConditions()) {
                     CoreValueFactory vf = query.getValueFactory();
                     if (lowerBound != null) {
-                        operand1.apply(f, Operator.GREATER_OR_EQUAL, vf.createValue(lowerBound));
+                        operand1.restrict(f, Operator.GREATER_OR_EQUAL, vf.createValue(lowerBound));
                     }
                     if (upperBound != null) {
-                        operand1.apply(f, Operator.LESS_OR_EQUAL, vf.createValue(upperBound));
+                        operand1.restrict(f, Operator.LESS_OR_EQUAL, vf.createValue(upperBound));
                     }
                 }
             } else {
-                operand1.apply(f, operator, v);
+                operand1.restrict(f, operator, v);
             }
         }
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DescendantNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DescendantNodeImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DescendantNodeImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DescendantNodeImpl.java Wed Sep 19 15:02:35 2012
@@ -36,14 +36,6 @@ public class DescendantNodeImpl extends 
         this.ancestorPath = ancestorPath;
     }
 
-    public String getSelectorName() {
-        return selectorName;
-    }
-
-    public String getAncestorPath() {
-        return ancestorPath;
-    }
-
     @Override
     public boolean evaluate() {
         String p = selector.currentPath();
@@ -61,7 +53,8 @@ public class DescendantNodeImpl extends 
 
     @Override
     public String toString() {
-        return "isdescendantnode(" + getSelectorName() + ", " + quotePath(ancestorPath) + ')';
+        return "isdescendantnode(" + quote(selectorName) + 
+                ", " +  quote(ancestorPath) + ')';
     }
 
     public void bindSelector(SourceImpl source) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DescendantNodeJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DescendantNodeJoinConditionImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DescendantNodeJoinConditionImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DescendantNodeJoinConditionImpl.java Wed Sep 19 15:02:35 2012
@@ -38,14 +38,6 @@ public class DescendantNodeJoinCondition
         this.ancestorSelectorName = ancestorSelectorName;
     }
 
-    public String getDescendantSelectorName() {
-        return descendantSelectorName;
-    }
-
-    public String getAncestorSelectorName() {
-        return ancestorSelectorName;
-    }
-
     @Override
     boolean accept(AstVisitor v) {
         return v.visit(this);
@@ -53,9 +45,9 @@ public class DescendantNodeJoinCondition
 
     @Override
     public String toString() {
-        String descendant = getDescendantSelectorName();
-        String ancestor = getAncestorSelectorName();
-        return "isdescendantnode(" + descendant + ", " + ancestor + ')';
+        return "isdescendantnode(" + 
+                quote(descendantSelectorName) + 
+                ", " + quote(ancestorSelectorName) + ')';
     }
 
     public void bindSelector(SourceImpl source) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DynamicOperandImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DynamicOperandImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DynamicOperandImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/DynamicOperandImpl.java Wed Sep 19 15:02:35 2012
@@ -27,7 +27,7 @@ public abstract class DynamicOperandImpl
 
     public abstract PropertyState currentProperty();
 
-    public abstract void apply(FilterImpl f, Operator operator, CoreValue v);
+    public abstract void restrict(FilterImpl f, Operator operator, CoreValue v);
 
     /**
      * Check whether the condition can be applied to a selector (to restrict the

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/EquiJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/EquiJoinConditionImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/EquiJoinConditionImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/EquiJoinConditionImpl.java Wed Sep 19 15:02:35 2012
@@ -43,22 +43,6 @@ public class EquiJoinConditionImpl exten
         this.property2Name = property2Name;
     }
 
-    public String getSelector1Name() {
-        return selector1Name;
-    }
-
-    public String getProperty1Name() {
-        return property1Name;
-    }
-
-    public String getSelector2Name() {
-        return selector2Name;
-    }
-
-    public String getProperty2Name() {
-        return property2Name;
-    }
-
     @Override
     boolean accept(AstVisitor v) {
         return v.visit(this);
@@ -66,9 +50,8 @@ public class EquiJoinConditionImpl exten
 
     @Override
     public String toString() {
-        // TODO quote property names?
-        return getSelector1Name() + '.' + getProperty1Name()
-                + " = " + getSelector2Name() + '.' + getProperty2Name();
+        return quote(selector1Name) + '.' + quote(property1Name) +
+                " = " + quote(selector2Name) + '.' + quote(property2Name);
     }
 
     public void bindSelector(SourceImpl source) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java Wed Sep 19 15:02:35 2012
@@ -47,14 +47,6 @@ public class FullTextSearchImpl extends 
         return fullTextSearchExpression;
     }
 
-    public String getPropertyName() {
-        return propertyName;
-    }
-
-    public String getSelectorName() {
-        return selectorName;
-    }
-
     @Override
     boolean accept(AstVisitor v) {
         return v.visit(this);
@@ -64,10 +56,10 @@ public class FullTextSearchImpl extends 
     public String toString() {
         StringBuilder builder = new StringBuilder();
         builder.append("contains(");
-        builder.append(getSelectorName());
+        builder.append(quote(selectorName));
         if (propertyName != null) {
             builder.append('.');
-            builder.append(propertyName);
+            builder.append(quote(propertyName));
             builder.append(", ");
         } else {
             builder.append(".*, ");

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchScoreImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchScoreImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchScoreImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchScoreImpl.java Wed Sep 19 15:02:35 2012
@@ -20,6 +20,8 @@ package org.apache.jackrabbit.oak.query.
 
 import org.apache.jackrabbit.oak.api.CoreValue;
 import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.SinglePropertyState;
+import org.apache.jackrabbit.oak.query.Query;
 import org.apache.jackrabbit.oak.query.index.FilterImpl;
 
 /**
@@ -34,10 +36,6 @@ public class FullTextSearchScoreImpl ext
         this.selectorName = selectorName;
     }
 
-    public String getSelectorName() {
-        return selectorName;
-    }
-
     @Override
     boolean accept(AstVisitor v) {
         return v.visit(this);
@@ -45,13 +43,18 @@ public class FullTextSearchScoreImpl ext
 
     @Override
     public String toString() {
-        return "score(" + getSelectorName() + ')';
+        return "score(" + quote(selectorName) + ')';
     }
 
     @Override
     public PropertyState currentProperty() {
-        // TODO support evaluating fulltext conditions (score)
-        return null;
+        PropertyState p = selector.currentProperty(Query.JCR_SCORE);
+        if (p == null) {
+            // TODO if score() is not supported by the index, use the value 0.0?
+            CoreValue v = query.getValueFactory().createValue(0.0);
+            p = new SinglePropertyState(Query.JCR_SCORE, v);
+        }
+        return p;
     }
 
     public void bindSelector(SourceImpl source) {
@@ -59,8 +62,14 @@ public class FullTextSearchScoreImpl ext
     }
 
     @Override
-    public void apply(FilterImpl f, Operator operator, CoreValue v) {
-        // TODO support fulltext index conditions (score)
+    public void restrict(FilterImpl f, Operator operator, CoreValue v) {
+        if (f.getSelector() == selector) {
+            if (operator == Operator.NOT_EQUAL && v != null) {
+                // not supported
+                return;
+            }
+            f.restrictProperty(Query.JCR_SCORE, operator, v);
+        }
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/JoinImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/JoinImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/JoinImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/JoinImpl.java Wed Sep 19 15:02:35 2012
@@ -46,10 +46,6 @@ public class JoinImpl extends SourceImpl
         return joinCondition;
     }
 
-    public String getJoinType() {
-        return joinType.toString();
-    }
-
     public SourceImpl getLeft() {
         return left;
     }
@@ -169,10 +165,4 @@ public class JoinImpl extends SourceImpl
         }
     }
 
-    @Override
-    public String currentPath() {
-        // TODO join: what is the path of a join? it this method ever called?
-        return left.currentPath();
-    }
-
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LengthImpl.java Wed Sep 19 15:02:35 2012
@@ -46,7 +46,7 @@ public class LengthImpl extends DynamicO
 
     @Override
     public String toString() {
-        return "length(" + getPropertyValue() + ')';
+        return "length(" + propertyValue + ')';
     }
 
     @Override
@@ -65,7 +65,7 @@ public class LengthImpl extends DynamicO
     }
 
     @Override
-    public void apply(FilterImpl f, Operator operator, CoreValue v) {
+    public void restrict(FilterImpl f, Operator operator, CoreValue v) {
         switch (v.getType()) {
         case PropertyType.LONG:
         case PropertyType.DECIMAL:
@@ -83,7 +83,8 @@ public class LengthImpl extends DynamicO
                             + PropertyType.nameFromValue(v.getType()) +
                             " and value " + v.toString());
         }
-        // TODO LENGTH(x) conditions: can use IS NOT NULL as a condition?
+        // LENGTH(x) implies x is not null
+        propertyValue.restrict(f, Operator.NOT_EQUAL, null);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LowerCaseImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LowerCaseImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LowerCaseImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/LowerCaseImpl.java Wed Sep 19 15:02:35 2012
@@ -62,9 +62,9 @@ public class LowerCaseImpl extends Dynam
     }
 
     @Override
-    public void apply(FilterImpl f, Operator operator, CoreValue v) {
-        // ignore
-        // TODO UPPER(x) conditions: can use IS NOT NULL?
+    public void restrict(FilterImpl f, Operator operator, CoreValue v) {
+        // LOWER(x) implies x is not null
+        operand.restrict(f, Operator.NOT_EQUAL, null);        
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeLocalNameImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeLocalNameImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeLocalNameImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeLocalNameImpl.java Wed Sep 19 15:02:35 2012
@@ -37,10 +37,6 @@ public class NodeLocalNameImpl extends D
         this.selectorName = selectorName;
     }
 
-    public String getSelectorName() {
-        return selectorName;
-    }
-
     @Override
     boolean accept(AstVisitor v) {
         return v.visit(this);
@@ -48,7 +44,7 @@ public class NodeLocalNameImpl extends D
 
     @Override
     public String toString() {
-        return "localname(" + getSelectorName() + ')';
+        return "localname(" + quote(selectorName) + ')';
     }
 
     public void bindSelector(SourceImpl source) {
@@ -68,7 +64,7 @@ public class NodeLocalNameImpl extends D
     }
 
     @Override
-    public void apply(FilterImpl f, Operator operator, CoreValue v) {
+    public void restrict(FilterImpl f, Operator operator, CoreValue v) {
         // TODO support LOCALNAME index conditions
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java Wed Sep 19 15:02:35 2012
@@ -38,10 +38,6 @@ public class NodeNameImpl extends Dynami
         this.selectorName = selectorName;
     }
 
-    public String getSelectorName() {
-        return selectorName;
-    }
-
     @Override
     boolean accept(AstVisitor v) {
         return v.visit(this);
@@ -49,7 +45,7 @@ public class NodeNameImpl extends Dynami
 
     @Override
     public String toString() {
-        return "name(" + getSelectorName() + ')';
+        return "name(" + quote(selectorName) + ')';
     }
 
     public void bindSelector(SourceImpl source) {
@@ -71,7 +67,7 @@ public class NodeNameImpl extends Dynami
     }
 
     @Override
-    public void apply(FilterImpl f, Operator operator, CoreValue v) {
+    public void restrict(FilterImpl f, Operator operator, CoreValue v) {
         if (!isName(v)) {
             throw new IllegalArgumentException("Invalid name value: " + v.toString());
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/OrderingImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/OrderingImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/OrderingImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/OrderingImpl.java Wed Sep 19 15:02:35 2012
@@ -36,10 +36,6 @@ public class OrderingImpl extends AstEle
         return operand;
     }
 
-    public String getOrder() {
-        return order.getName();
-    }
-
     @Override
     boolean accept(AstVisitor v) {
         return v.visit(this);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyExistenceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyExistenceImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyExistenceImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyExistenceImpl.java Wed Sep 19 15:02:35 2012
@@ -36,14 +36,6 @@ public class PropertyExistenceImpl exten
         this.propertyName = propertyName;
     }
 
-    public String getPropertyName() {
-        return propertyName;
-    }
-
-    public String getSelectorName() {
-        return selectorName;
-    }
-
     @Override
     public boolean evaluate() {
         PropertyState p = selector.currentProperty(propertyName);
@@ -57,8 +49,7 @@ public class PropertyExistenceImpl exten
 
     @Override
     public String toString() {
-        // TODO quote property names?
-        return getSelectorName() + '.' + propertyName + " is not null";
+        return quote(selectorName) + '.' + quote(propertyName) + " is not null";
     }
 
     public void bindSelector(SourceImpl source) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java Wed Sep 19 15:02:35 2012
@@ -67,8 +67,7 @@ public class PropertyValueImpl extends D
 
     @Override
     public String toString() {
-        // TODO quote property names?
-        String s = getSelectorName() + '.' + propertyName;
+        String s = quote(selectorName) + '.' + quote(propertyName);
         if (propertyType != PropertyType.UNDEFINED) {
             s = "property(" + s + ", '" +
                     PropertyType.nameFromValue(propertyType).toLowerCase(Locale.ENGLISH) +
@@ -152,7 +151,7 @@ public class PropertyValueImpl extends D
     }
 
     @Override
-    public void apply(FilterImpl f, Operator operator, CoreValue v) {
+    public void restrict(FilterImpl f, Operator operator, CoreValue v) {
         if (f.getSelector() == selector) {
             if (operator == Operator.NOT_EQUAL && v != null) {
                 // not supported

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SameNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SameNodeImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SameNodeImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SameNodeImpl.java Wed Sep 19 15:02:35 2012
@@ -35,14 +35,6 @@ public class SameNodeImpl extends Constr
         this.path = path;
     }
 
-    public String getSelectorName() {
-        return selectorName;
-    }
-
-    public String getPath() {
-        return path;
-    }
-
     @Override
     public boolean evaluate() {
         String p = getAbsolutePath(path);
@@ -57,7 +49,8 @@ public class SameNodeImpl extends Constr
 
     @Override
     public String toString() {
-        return "issamenode(" + getSelectorName() + ", " + quotePath(path) + ')';
+        return "issamenode(" +  quote(selectorName) + 
+                ", " + quote(path) + ')';
     }
 
     public void bindSelector(SourceImpl source) {

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=1387630&r1=1387629&r2=1387630&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 Wed Sep 19 15:02:35 2012
@@ -39,18 +39,6 @@ public class SameNodeJoinConditionImpl e
         this.selector2Path = selector2Path;
     }
 
-    public String getSelector1Name() {
-        return selector1Name;
-    }
-
-    public String getSelector2Name() {
-        return selector2Name;
-    }
-
-    public String getSelector2Path() {
-        return selector2Path;
-    }
-
     @Override
     boolean accept(AstVisitor v) {
         return v.visit(this);
@@ -60,12 +48,12 @@ public class SameNodeJoinConditionImpl e
     public String toString() {
         StringBuilder builder = new StringBuilder();
         builder.append("issamenode(");
-        builder.append(getSelector1Name());
+        builder.append(quote(selector1Name));
         builder.append(", ");
-        builder.append(getSelector2Name());
+        builder.append(quote(selector2Name));
         if (selector2Path != null) {
             builder.append(", ");
-            builder.append(quotePath(selector2Path));
+            builder.append(quote(selector2Path));
         }
         builder.append(')');
         return builder.toString();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java Wed Sep 19 15:02:35 2012
@@ -36,9 +36,6 @@ import org.apache.jackrabbit.oak.spi.sta
  */
 public class SelectorImpl extends SourceImpl {
 
-    // TODO jcr:path isn't an official feature, support it?
-    public static final String PATH = "jcr:path";
-
     private static final String JCR_PRIMARY_TYPE = "jcr:primaryType";
 
     private static final String TYPE_BASE = "nt:base";
@@ -64,10 +61,6 @@ public class SelectorImpl extends Source
         this.selectorName = selectorName;
     }
 
-    public String getNodeTypeName() {
-        return nodeTypeName;
-    }
-
     public String getSelectorName() {
         return selectorName;
     }
@@ -79,7 +72,7 @@ public class SelectorImpl extends Source
 
     @Override
     public String toString() {
-        return "[" + nodeTypeName + "] as " + selectorName;
+        return quote(nodeTypeName) + " as " + quote(selectorName);
     }
 
 
@@ -180,13 +173,17 @@ public class SelectorImpl extends Source
         }
     }
 
-    @Override
+    /**
+     * Get the current absolute path (including workspace name)
+     *
+     * @return the path
+     */
     public String currentPath() {
         return cursor == null ? null : cursor.currentRow().getPath();
     }
 
     public PropertyState currentProperty(String propertyName) {
-        if (propertyName.equals(PATH)) {
+        if (propertyName.equals(Query.JCR_PATH)) {
             String p = currentPath();
             if (p == null) {
                 return null;
@@ -197,7 +194,7 @@ public class SelectorImpl extends Source
                 return null;
             }
             CoreValue v = query.getValueFactory().createValue(local);
-            return new SinglePropertyState(PATH, v);
+            return new SinglePropertyState(Query.JCR_PATH, v);
         }
         if (cursor == null) {
             return null;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SourceImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SourceImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SourceImpl.java Wed Sep 19 15:02:35 2012
@@ -154,11 +154,4 @@ public abstract class SourceImpl extends
      */
     public abstract boolean next();
 
-    /**
-     * Get the current absolute path (including workspace name)
-     *
-     * @return the path
-     */
-    public abstract String currentPath();
-
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/UpperCaseImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/UpperCaseImpl.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/UpperCaseImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/UpperCaseImpl.java Wed Sep 19 15:02:35 2012
@@ -62,9 +62,9 @@ public class UpperCaseImpl extends Dynam
     }
 
     @Override
-    public void apply(FilterImpl f, Operator operator, CoreValue v) {
-        // ignore
-        // TODO UPPER(x) conditions: can use IS NOT NULL?
+    public void restrict(FilterImpl f, Operator operator, CoreValue v) {
+        // UPPER(x) implies x is not null
+        operand.restrict(f, Operator.NOT_EQUAL, null);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java Wed Sep 19 15:02:35 2012
@@ -87,8 +87,8 @@ public class QueryTest extends AbstractQ
         result = executeQuery("explain select * from [nt:base] where id = 1 order by id",
                 QueryEngineImpl.SQL2, null).getRows().iterator();
         assertTrue(result.hasNext());
-        assertEquals("[nt:base] as nt:base " +
-                "/* traverse \"//*\" where nt:base.id = cast('1' as long) */",
+        assertEquals("[nt:base] as [nt:base] " +
+                "/* traverse \"//*\" where [nt:base].[id] = cast('1' as long) */",
                 result.next().getValue("plan").getString());
 
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt Wed Sep 19 15:02:35 2012
@@ -34,6 +34,9 @@ select * from [nt:base] where name = 'He
 select * from [nt:base] where name = 'World'
 /test/a
 
+select * from [nt:base] where isdescendantnode('/test') and name = 'World' and score() >= 0.0
+/test/a
+
 commit / - "test"
 
 # expected error on two selectors with the same name
@@ -150,7 +153,7 @@ select * from [nt:base] as p inner join 
 /parents, /parents/p2
 
 explain select * from [nt:base] as p inner join [nt:base] as p2 on issamenode(p2, p) where p.[jcr:path] = '/parents'
-[nt:base] as p /* traverse "//*" where p.jcr:path = cast('/parents' as string) */ inner join [nt:base] as p2 /* traverse "" */ on issamenode(p2, p, [.])
+[nt:base] as [p] /* traverse "//*" where [p].[jcr:path] = cast('/parents' as string) */ inner join [nt:base] as [p2] /* traverse "" */ on issamenode([p2], [p], [.])
 
 select * from [nt:base] as p inner join [nt:base] as p2 on issamenode(p2, p) where p.[jcr:path] = '/parents'
 /parents, /parents
@@ -206,7 +209,7 @@ select * from [nt:base] as p left outer 
 /parents/p2, /children/c3
 
 explain select * from [nt:base] as p inner join [nt:base] as c on p.id = c.p
-[nt:base] as p /* traverse "//*" where p.id is not null */ inner join [nt:base] as c /* traverse "//*" where c.p is not null */ on p.id = c.p
+[nt:base] as [p] /* traverse "//*" where [p].[id] is not null */ inner join [nt:base] as [c] /* traverse "//*" where [c].[p] is not null */ on [p].[id] = [c].[p]
 
 measure select * from [nt:base] as p inner join [nt:base] as c on p.id = c.p
 c, 630

Modified: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt?rev=1387630&r1=1387629&r2=1387630&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt Wed Sep 19 15:02:35 2012
@@ -28,10 +28,10 @@
 commit / + "test": { "a": { "id": "ref:123" }, "b": { "id" : "str:123" }}
 
 explain select * from [nt:base] where property([*], 'REFERENCE') = CAST('123' AS REFERENCE)
-[nt:base] as nt:base /* traverse "//*" where property(nt:base.*, 'reference') = cast('123' as reference) */
+[nt:base] as [nt:base] /* traverse "//*" where property([nt:base].[*], 'reference') = cast('123' as reference) */
 
 explain select * from [nt:base] where property(id, 'REFERENCE') = CAST('123' AS REFERENCE)
-[nt:base] as nt:base /* traverse "//*" where property(nt:base.id, 'reference') = cast('123' as reference) */
+[nt:base] as [nt:base] /* traverse "//*" where property([nt:base].[id], 'reference') = cast('123' as reference) */
 
 select * from [nt:base] where property([*], 'REFERENCE') = CAST('123' AS REFERENCE)
 /test/a
@@ -41,10 +41,10 @@ commit /oak-index + "indexes": { "type":
 commit /oak-index/indexes + "prefix@ref:": {}
 
 explain select * from [nt:base] where property([*], 'REFERENCE') = CAST('123' AS REFERENCE)
-[nt:base] as nt:base /* prefixIndex "ref:123" where property(nt:base.*, 'reference') = cast('123' as reference) */
+[nt:base] as [nt:base] /* prefixIndex "ref:123" where property([nt:base].[*], 'reference') = cast('123' as reference) */
 
 explain select * from [nt:base] where property(id, 'REFERENCE') = CAST('123' AS REFERENCE)
-[nt:base] as nt:base /* prefixIndex "ref:123" where property(nt:base.id, 'reference') = cast('123' as reference) */
+[nt:base] as [nt:base] /* prefixIndex "ref:123" where property([nt:base].[id], 'reference') = cast('123' as reference) */
 
 select * from [nt:base] where property([*], 'REFERENCE') = CAST('123' AS REFERENCE)
 /test/a
@@ -70,7 +70,7 @@ select * from [nt:base] where id is not 
 /test/b
 
 explain select * from [nt:base] where id = '10'
-[nt:base] as nt:base /* propertyIndex "id [10..10]" where nt:base.id = cast('10' as string) */
+[nt:base] as [nt:base] /* propertyIndex "id [10..10]" where [nt:base].[id] = cast('10' as string) */
 
 select * from [nt:base] where id = '10'
 /test/a
@@ -79,7 +79,7 @@ select [jcr:path], * from [nt:base] wher
 /test/a, null
 
 explain select * from [nt:base] where id > '10'
-[nt:base] as nt:base /* traverse "//*" where nt:base.id > cast('10' as string) */
+[nt:base] as [nt:base] /* traverse "//*" where [nt:base].[id] > cast('10' as string) */
 
 commit / - "test"
 commit /oak-index/indexes - "property@id,unique"
@@ -89,10 +89,10 @@ commit /oak-index/indexes - "property@id
 commit / + "test": { "jcr:resource": {}, "resource": { "x" : {}}}
 
 explain select * from [nt:base] as b where ischildnode(b, '/test')
-[nt:base] as b /* traverse "/test/*" where ischildnode(b, [/test]) */
+[nt:base] as [b] /* traverse "/test/*" where ischildnode([b], [/test]) */
 
 explain select * from [nt:base] as b where isdescendantnode(b, '/test')
-[nt:base] as b /* traverse "/test//*" where isdescendantnode(b, [/test]) */
+[nt:base] as [b] /* traverse "/test//*" where isdescendantnode([b], [/test]) */
 
 commit / - "test"
 
@@ -100,7 +100,7 @@ commit / + "parents": { "p0": {"id": "0"
 commit / + "children": { "c1": {"p": "1"}, "c2": {"p": "1"}, "c3": {"p": "2"}, "c4": {"p": "3"}}
 
 explain select * from [nt:base] as p inner join [nt:base] as c on p.id = c.p
-[nt:base] as p /* traverse "//*" where p.id is not null */ inner join [nt:base] as c /* traverse "//*" where c.p is not null */ on p.id = c.p
+[nt:base] as [p] /* traverse "//*" where [p].[id] is not null */ inner join [nt:base] as [c] /* traverse "//*" where [c].[p] is not null */ on [p].[id] = [c].[p]
 
 commit / - "parents"
 commit / - "children"



Mime
View raw message