You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/11/11 19:04:42 UTC

[1/3] usergrid git commit: Fix in UnionScanColumn comparator fixes order or operations error https://issues.apache.org/jira/browse/USERGRID-1099

Repository: usergrid
Updated Branches:
  refs/heads/1.x 7cb7b3fdf -> bd4fd2643


Fix in UnionScanColumn comparator fixes order or operations error https://issues.apache.org/jira/browse/USERGRID-1099


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/c776a2fb
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/c776a2fb
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/c776a2fb

Branch: refs/heads/1.x
Commit: c776a2fb34d76f5cd779009a200ab8cf1e288b5d
Parents: 0706444
Author: Dave Johnson <sn...@apache.org>
Authored: Thu Nov 5 13:58:07 2015 -0500
Committer: Dave Johnson <sn...@apache.org>
Committed: Thu Nov 5 13:58:07 2015 -0500

----------------------------------------------------------------------
 .../query/ir/result/AbstractScanColumn.java     |  2 +-
 .../query/ir/result/UnionIterator.java          |  6 +-
 .../persistence/ParenthesisProblemIT.java       | 79 ++++++++++++++++++++
 3 files changed, 83 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/c776a2fb/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumn.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumn.java b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumn.java
index cabb710..f99103c 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumn.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumn.java
@@ -69,7 +69,7 @@ public abstract class AbstractScanColumn implements ScanColumn {
 
         ScanColumn that = ( ScanColumn ) o;
 
-        return uuid.equals( that.getUUID() );
+        return getUUID().equals( that.getUUID() );
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/c776a2fb/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UnionIterator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UnionIterator.java b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UnionIterator.java
index 526fced..3f786f8 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UnionIterator.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UnionIterator.java
@@ -264,13 +264,13 @@ public class UnionIterator extends MultiIterator {
             if ( this == o ) {
                 return true;
             }
-            if ( !( o instanceof UnionScanColumn ) ) {
+            if ( !( o instanceof ScanColumn ) ) {
                 return false;
             }
 
-            final UnionScanColumn that = ( UnionScanColumn ) o;
+            final ScanColumn that = ( ScanColumn ) o;
 
-            return delegate.getUUID().equals( that.delegate.getUUID() );
+            return getUUID().equals( that.getUUID() );
         }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/c776a2fb/stack/core/src/test/java/org/apache/usergrid/persistence/ParenthesisProblemIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/ParenthesisProblemIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/ParenthesisProblemIT.java
new file mode 100644
index 0000000..ab52416
--- /dev/null
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/ParenthesisProblemIT.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.persistence;
+
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.usergrid.AbstractCoreIT;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+
+
+public class ParenthesisProblemIT extends AbstractCoreIT {
+    private static final Logger logger = LoggerFactory.getLogger( ParenthesisProblemIT.class );
+
+    @Test // this test passes
+    public void parenthesisProblem1() throws Exception {
+        // C = c and ( A > a or B = false )
+        parenthesisProblem(1, "color = 'tabby' and (age > 7 or large = true)");
+    }
+    
+    @Test // this test fails
+    public void parenthesisProblem2() throws Exception {
+        // same as #1 except for order of things listed in 'and' operation
+        // ( A > a or B = false ) and C = c
+        parenthesisProblem(1, "select * where (age > 7 or large = true) and color = 'tabby'");
+    }
+
+    private void parenthesisProblem( int expect, String query ) throws Exception {
+        UUID applicationId = setup.createApplication(
+                "testOrganization", "parenthesisProblem_" + RandomStringUtils.randomAlphanumeric(10));
+        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+
+        em.create( "cat", new HashMap<String, Object>() {{
+            put("name","enzo");
+            put("color","orange");
+            put("large", true);
+            put("age",6);
+        }});
+
+        em.create( "cat", new HashMap<String, Object> () {{
+            put("name","marquee");
+            put("color","grey");
+            put("large",false);
+            put("age",8);
+        }});
+
+        em.create( "cat", new HashMap<String, Object> () {{
+            put("name","bertha");
+            put("color","tabby");
+            put("large",true);
+            put("age",1);
+        }});
+
+        final Results entities = em.searchCollection(
+                new SimpleEntityRef("application", applicationId), "cats", Query.fromQL(query));
+        
+        assertEquals(expect, entities.size());
+    }
+}


[2/3] usergrid git commit: Merge branch '1.x' into usergrid-1099

Posted by to...@apache.org.
Merge branch '1.x' into usergrid-1099


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/d37be706
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/d37be706
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/d37be706

Branch: refs/heads/1.x
Commit: d37be7066db054688dc85c3a9b497d51acb07138
Parents: c776a2f 7cb7b3f
Author: Dave Johnson <sn...@apache.org>
Authored: Thu Nov 5 14:20:36 2015 -0500
Committer: Dave Johnson <sn...@apache.org>
Committed: Thu Nov 5 14:20:36 2015 -0500

----------------------------------------------------------------------
 .../src/main/java/CpQueryFilter.tokens          | 47 --------------------
 1 file changed, 47 deletions(-)
----------------------------------------------------------------------



[3/3] usergrid git commit: Comments only.

Posted by to...@apache.org.
Comments only.


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/bd4fd264
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/bd4fd264
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/bd4fd264

Branch: refs/heads/1.x
Commit: bd4fd264378d9874422f1ace0b2ee3b0d57adfc2
Parents: d37be70
Author: Dave Johnson <sn...@apache.org>
Authored: Fri Nov 6 15:22:57 2015 -0500
Committer: Dave Johnson <sn...@apache.org>
Committed: Fri Nov 6 15:22:57 2015 -0500

----------------------------------------------------------------------
 .../org/apache/usergrid/persistence/ParenthesisProblemIT.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/bd4fd264/stack/core/src/test/java/org/apache/usergrid/persistence/ParenthesisProblemIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/ParenthesisProblemIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/ParenthesisProblemIT.java
index ab52416..100fd0f 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/ParenthesisProblemIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/ParenthesisProblemIT.java
@@ -29,16 +29,17 @@ import java.util.UUID;
 import static org.junit.Assert.assertEquals;
 
 
+// Created for https://issues.apache.org/jira/browse/USERGRID-1099
 public class ParenthesisProblemIT extends AbstractCoreIT {
     private static final Logger logger = LoggerFactory.getLogger( ParenthesisProblemIT.class );
 
-    @Test // this test passes
+    @Test
     public void parenthesisProblem1() throws Exception {
         // C = c and ( A > a or B = false )
         parenthesisProblem(1, "color = 'tabby' and (age > 7 or large = true)");
     }
     
-    @Test // this test fails
+    @Test 
     public void parenthesisProblem2() throws Exception {
         // same as #1 except for order of things listed in 'and' operation
         // ( A > a or B = false ) and C = c