cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject cassandra git commit: Do not persist ReversedType in system_schema.columns
Date Thu, 17 Sep 2015 17:25:35 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 dd9a0abf2 -> 2db8370fd


Do not persist ReversedType in system_schema.columns

patch by Aleksey Yeschenko; reviewed by Sam Tunnicliffe for
CASSANDRA-6717


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

Branch: refs/heads/cassandra-3.0
Commit: 2db8370fdfff7353a8f12e75c47cc1e80eee1e9a
Parents: dd9a0ab
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Mon Sep 14 22:03:35 2015 +0100
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Thu Sep 17 18:24:00 2015 +0100

----------------------------------------------------------------------
 ...core-3.0.0-alpha3-7b60bed-SNAPSHOT-shaded.jar | Bin 0 -> 2217129 bytes
 ...core-3.0.0-alpha3-d56dd0b-SNAPSHOT-shaded.jar | Bin 2216851 -> 0 bytes
 ...river-internal-only-3.0.0a2.post0-9f91a6d.zip | Bin 0 -> 230797 bytes
 ...river-internal-only-3.0.0a2.post0-fecbd54.zip | Bin 230674 -> 0 bytes
 .../cassandra/config/ColumnDefinition.java       |  13 +++++++++++++
 .../apache/cassandra/schema/SchemaKeyspace.java  |  12 +++++++++++-
 6 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2db8370f/lib/cassandra-driver-core-3.0.0-alpha3-7b60bed-SNAPSHOT-shaded.jar
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-core-3.0.0-alpha3-7b60bed-SNAPSHOT-shaded.jar b/lib/cassandra-driver-core-3.0.0-alpha3-7b60bed-SNAPSHOT-shaded.jar
new file mode 100644
index 0000000..405919f
Binary files /dev/null and b/lib/cassandra-driver-core-3.0.0-alpha3-7b60bed-SNAPSHOT-shaded.jar
differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2db8370f/lib/cassandra-driver-core-3.0.0-alpha3-d56dd0b-SNAPSHOT-shaded.jar
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-core-3.0.0-alpha3-d56dd0b-SNAPSHOT-shaded.jar b/lib/cassandra-driver-core-3.0.0-alpha3-d56dd0b-SNAPSHOT-shaded.jar
deleted file mode 100644
index 79d5a8a..0000000
Binary files a/lib/cassandra-driver-core-3.0.0-alpha3-d56dd0b-SNAPSHOT-shaded.jar and /dev/null
differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2db8370f/lib/cassandra-driver-internal-only-3.0.0a2.post0-9f91a6d.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0a2.post0-9f91a6d.zip b/lib/cassandra-driver-internal-only-3.0.0a2.post0-9f91a6d.zip
new file mode 100644
index 0000000..ff4d150
Binary files /dev/null and b/lib/cassandra-driver-internal-only-3.0.0a2.post0-9f91a6d.zip
differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2db8370f/lib/cassandra-driver-internal-only-3.0.0a2.post0-fecbd54.zip
----------------------------------------------------------------------
diff --git a/lib/cassandra-driver-internal-only-3.0.0a2.post0-fecbd54.zip b/lib/cassandra-driver-internal-only-3.0.0a2.post0-fecbd54.zip
deleted file mode 100644
index fe9e0de..0000000
Binary files a/lib/cassandra-driver-internal-only-3.0.0a2.post0-fecbd54.zip and /dev/null
differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2db8370f/src/java/org/apache/cassandra/config/ColumnDefinition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/ColumnDefinition.java b/src/java/org/apache/cassandra/config/ColumnDefinition.java
index 7dc425f..96513c2 100644
--- a/src/java/org/apache/cassandra/config/ColumnDefinition.java
+++ b/src/java/org/apache/cassandra/config/ColumnDefinition.java
@@ -37,6 +37,11 @@ public class ColumnDefinition extends ColumnSpecification implements Comparable<
 
     public static final int NO_POSITION = -1;
 
+    public enum ClusteringOrder
+    {
+        ASC, DESC, NONE
+    }
+
     /*
      * The type of CQL3 column this definition represents.
      * There is 4 main type of CQL3 columns: those parts of the partition key,
@@ -222,6 +227,14 @@ public class ColumnDefinition extends ColumnSpecification implements
Comparable<
         return kind == Kind.REGULAR;
     }
 
+    public ClusteringOrder clusteringOrder()
+    {
+        if (!isClusteringColumn())
+            return ClusteringOrder.NONE;
+
+        return type.isReversed() ? ClusteringOrder.DESC : ClusteringOrder.ASC;
+    }
+
     /**
      * For convenience sake, if position == NO_POSITION, this method will return 0. The callers
should first check
      * isOnAllComponents() to distinguish between proper 0 position and NO_POSITION.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2db8370f/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
index d8992bd..2376fad 100644
--- a/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
+++ b/src/java/org/apache/cassandra/schema/SchemaKeyspace.java
@@ -34,6 +34,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.*;
+import org.apache.cassandra.config.ColumnDefinition.ClusteringOrder;
 import org.apache.cassandra.cql3.ColumnIdentifier;
 import org.apache.cassandra.cql3.QueryProcessor;
 import org.apache.cassandra.cql3.UntypedResultSet;
@@ -117,6 +118,7 @@ public final class SchemaKeyspace
                 + "keyspace_name text,"
                 + "table_name text,"
                 + "column_name text,"
+                + "clustering_order text,"
                 + "column_name_bytes blob,"
                 + "kind text,"
                 + "position int,"
@@ -1163,10 +1165,15 @@ public final class SchemaKeyspace
     {
         RowUpdateBuilder adder = new RowUpdateBuilder(Columns, timestamp, mutation).clustering(table.cfName,
column.name.toString());
 
+        AbstractType<?> type = column.type;
+        if (type instanceof ReversedType)
+            type = ((ReversedType) type).baseType;
+
         adder.add("column_name_bytes", column.name.bytes)
              .add("kind", column.kind.toString().toLowerCase())
              .add("position", column.isOnAllComponents() ? ColumnDefinition.NO_POSITION :
column.position())
-             .add("type", column.type.toString())
+             .add("clustering_order", column.clusteringOrder().toString().toLowerCase())
+             .add("type", type.toString())
              .build();
     }
 
@@ -1193,8 +1200,11 @@ public final class SchemaKeyspace
         ColumnDefinition.Kind kind = ColumnDefinition.Kind.valueOf(row.getString("kind").toUpperCase());
 
         int position = row.getInt("position");
+        ClusteringOrder order = ClusteringOrder.valueOf(row.getString("clustering_order").toUpperCase());
 
         AbstractType<?> type = parseType(row.getString("type"));
+        if (order == ClusteringOrder.DESC)
+            type = ReversedType.getInstance(type);
 
         return new ColumnDefinition(keyspace, table, name, type, position, kind);
     }


Mime
View raw message