You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2015/06/19 16:56:05 UTC

[1/2] cassandra git commit: Fix mixing min, max, and count aggregates for blob type

Repository: cassandra
Updated Branches:
  refs/heads/trunk e246ec258 -> 1af3c3b98


Fix mixing min, max, and count aggregates for blob type

patch by Aleksey Yeschenko; reviewed by Robert Stupp for CASSANDRA-9622


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

Branch: refs/heads/trunk
Commit: 716b253a771d50c2365608cf7cbc992e3683feed
Parents: 947edf1
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Fri Jun 19 14:29:22 2015 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Fri Jun 19 17:55:20 2015 +0300

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../cassandra/cql3/functions/Functions.java     | 38 +++++++++++++++-----
 2 files changed, 30 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/716b253a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 56f0dc0..4886850 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2
+ * Fix mixing min, max, and count aggregates for blob type (CASSANRA-9622)
  * Rename class for DATE type in Java driver (CASSANDRA-9563)
  * Duplicate compilation of UDFs on coordinator (CASSANDRA-9475)
  * Fix connection leak in CqlRecordWriter (CASSANDRA-9576)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/716b253a/src/java/org/apache/cassandra/cql3/functions/Functions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/functions/Functions.java b/src/java/org/apache/cassandra/cql3/functions/Functions.java
index d6a8ab0..018c35c 100644
--- a/src/java/org/apache/cassandra/cql3/functions/Functions.java
+++ b/src/java/org/apache/cassandra/cql3/functions/Functions.java
@@ -64,18 +64,25 @@ public abstract class Functions
         {
             // Note: because text and varchar ends up being synonymous, our automatic makeToBlobFunction doesn't work
             // for varchar, so we special case it below. We also skip blob for obvious reasons.
-            if (type == CQL3Type.Native.VARCHAR || type == CQL3Type.Native.BLOB)
-                continue;
-
-            declare(BytesConversionFcts.makeToBlobFunction(type.getType()));
-            declare(BytesConversionFcts.makeFromBlobFunction(type.getType()));
-
-            declare(AggregateFcts.makeCountFunction(type.getType()));
-            declare(AggregateFcts.makeMaxFunction(type.getType()));
-            declare(AggregateFcts.makeMinFunction(type.getType()));
+            if (type != CQL3Type.Native.VARCHAR && type != CQL3Type.Native.BLOB)
+            {
+                declare(BytesConversionFcts.makeToBlobFunction(type.getType()));
+                declare(BytesConversionFcts.makeFromBlobFunction(type.getType()));
+            }
         }
         declare(BytesConversionFcts.VarcharAsBlobFct);
         declare(BytesConversionFcts.BlobAsVarcharFact);
+
+        for (CQL3Type type : CQL3Type.Native.values())
+        {
+            // special case varchar to avoid duplicating functions for UTF8Type
+            if (type != CQL3Type.Native.VARCHAR)
+            {
+                declare(AggregateFcts.makeCountFunction(type.getType()));
+                declare(AggregateFcts.makeMaxFunction(type.getType()));
+                declare(AggregateFcts.makeMinFunction(type.getType()));
+            }
+        }
         declare(AggregateFcts.sumFunctionForInt32);
         declare(AggregateFcts.sumFunctionForLong);
         declare(AggregateFcts.sumFunctionForFloat);
@@ -340,6 +347,19 @@ public abstract class Functions
         return all;
     }
 
+    /*
+     * We need to compare the CQL3 representation of the type because comparing
+     * the AbstractType will fail for example if a UDT has been changed.
+     * Reason is that UserType.equals() takes the field names and types into account.
+     * Example CQL sequence that would fail when comparing AbstractType:
+     *    CREATE TYPE foo ...
+     *    CREATE FUNCTION bar ( par foo ) RETURNS foo ...
+     *    ALTER TYPE foo ADD ...
+     * or
+     *    ALTER TYPE foo ALTER ...
+     * or
+     *    ALTER TYPE foo RENAME ...
+     */
     public static boolean typeEquals(AbstractType<?> t1, AbstractType<?> t2)
     {
         return t1.asCQL3Type().toString().equals(t2.asCQL3Type().toString());


[2/2] cassandra git commit: Merge branch 'cassandra-2.2' into trunk

Posted by al...@apache.org.
Merge branch 'cassandra-2.2' into trunk


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

Branch: refs/heads/trunk
Commit: 1af3c3b98961df39aff3159d6a929e3de9194542
Parents: e246ec2 716b253
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Fri Jun 19 17:56:33 2015 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Fri Jun 19 17:56:33 2015 +0300

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../cassandra/cql3/functions/Functions.java     | 38 +++++++++++++++-----
 2 files changed, 30 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1af3c3b9/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 9b4e474,4886850..c631c8d
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,15 -1,5 +1,16 @@@
 +3.0:
 + * Add nodetool command to replay batchlog (CASSANDRA-9547)
 + * Make file buffer cache independent of paths being read (CASSANDRA-8897)
 + * Remove deprecated legacy Hadoop code (CASSANDRA-9353)
 + * Decommissioned nodes will not rejoin the cluster (CASSANDRA-8801)
 + * Change gossip stabilization to use endpoit size (CASSANDRA-9401)
 + * Change default garbage collector to G1 (CASSANDRA-7486)
 + * Populate TokenMetadata early during startup (CASSANDRA-9317)
 + * undeprecate cache recentHitRate (CASSANDRA-6591)
 +
 +
  2.2
+  * Fix mixing min, max, and count aggregates for blob type (CASSANRA-9622)
   * Rename class for DATE type in Java driver (CASSANDRA-9563)
   * Duplicate compilation of UDFs on coordinator (CASSANDRA-9475)
   * Fix connection leak in CqlRecordWriter (CASSANDRA-9576)