jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1504113 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/query/ast/AndImpl.java main/java/org/apache/jackrabbit/oak/query/ast/OrImpl.java test/resources/org/apache/jackrabbit/oak/query/sql2_index.txt
Date Wed, 17 Jul 2013 13:08:24 GMT
Author: thomasm
Date: Wed Jul 17 13:08:24 2013
New Revision: 1504113

URL: http://svn.apache.org/r1504113
Log:
OAK-899 Query: simplify duplicate conditions

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AndImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/OrImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_index.txt

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AndImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AndImpl.java?rev=1504113&r1=1504112&r2=1504113&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AndImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/AndImpl.java
Wed Jul 17 13:08:24 2013
@@ -32,7 +32,7 @@ import com.google.common.collect.Sets;
  */
 public class AndImpl extends ConstraintImpl {
 
-    private final ConstraintImpl constraint1, constraint2;
+    private ConstraintImpl constraint1, constraint2;
 
     public AndImpl(ConstraintImpl constraint1, ConstraintImpl constraint2) {
         this.constraint1 = constraint1;
@@ -49,6 +49,8 @@ public class AndImpl extends ConstraintI
 
     @Override
     public ConstraintImpl simplify() {
+        constraint1 = constraint1.simplify();
+        constraint2 = constraint2.simplify();
         if (constraint1.equals(constraint2)) {
             return constraint1;
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/OrImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/OrImpl.java?rev=1504113&r1=1504112&r2=1504113&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/OrImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/OrImpl.java
Wed Jul 17 13:08:24 2013
@@ -33,8 +33,7 @@ import com.google.common.collect.Sets;
  */
 public class OrImpl extends ConstraintImpl {
 
-    private final ConstraintImpl constraint1;
-    private final ConstraintImpl constraint2;
+    private ConstraintImpl constraint1, constraint2;
 
     public OrImpl(ConstraintImpl constraint1, ConstraintImpl constraint2) {
         this.constraint1 = constraint1;
@@ -51,6 +50,8 @@ public class OrImpl extends ConstraintIm
     
     @Override
     public ConstraintImpl simplify() {
+        constraint1 = constraint1.simplify();
+        constraint2 = constraint2.simplify();
         if (constraint1.equals(constraint2)) {
             return constraint1;
         }

Modified: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_index.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_index.txt?rev=1504113&r1=1504112&r2=1504113&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_index.txt
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_index.txt
Wed Jul 17 13:08:24 2013
@@ -31,6 +31,9 @@ explain select excerpt(.) from [nt:resou
 explain select excerpt(.) from [nt:resource] where contains(*, 'jackrabbit') or contains(*,
'jackrabbit')
 [nt:resource] as [nt:resource] /* traverse "*" where contains([nt:resource].[*], cast('jackrabbit'
as string)) */
 
+explain select excerpt(.) from [nt:resource] where (contains(*, 'jackrabbit') or contains(*,
'jackrabbit')) and x = '1'
+[nt:resource] as [nt:resource] /* traverse "*" where (contains([nt:resource].[*], cast('jackrabbit'
as string))) and ([nt:resource].[x] = cast('1' as string)) */
+
 explain select * from [nt:base] where [jcr:uuid]=1 or [b]=2
 [nt:base] as [nt:base] /* traverse "*" */
 



Mime
View raw message