cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Bug when composite index is created in a table having collections
Date Mon, 05 Nov 2012 16:18:03 GMT
Updated Branches:
  refs/heads/trunk 811359db0 -> 617a4ab6f


Bug when composite index is created in a table having collections

patch by slebresne; reviewed by jbellis for CASSANDRA-4909


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

Branch: refs/heads/trunk
Commit: 617a4ab6fd1ee76820a95de5fe32a5b283e07c06
Parents: 811359d
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Mon Nov 5 17:17:16 2012 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Mon Nov 5 17:17:16 2012 +0100

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../cql3/statements/CreateIndexStatement.java      |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/617a4ab6/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 89c046e..02385df 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -51,6 +51,7 @@
  * Add tracing support to the binary protocol (CASSANDRA-4699)
  * Don't allow prepared marker inside collections (CASSANDRA-4890)
  * Re-allow order by on non-selected columns (CASSANDRA-4645)
+ * Bug when composite index is created in a table having collections (CASSANDRA-4909)
 Merged from 1.1:
  * add get[Row|Key]CacheEntries to CacheServiceMBean (CASSANDRA-4859)
  * fix get_paged_slice to wrap to next row correctly (CASSANDRA-4816)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/617a4ab6/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java b/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
index 710de11..4e0f536 100644
--- a/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
@@ -76,11 +76,14 @@ public class CreateIndexStatement extends SchemaAlteringStatement
                 if (logger.isDebugEnabled())
                     logger.debug("Updating column {} definition for index {}", columnName,
indexName);
 
+                if (cd.getValidator().isCollection())
+                    throw new InvalidRequestException("Indexes on collections are no yet
supported");
+
                 if (cfDef.isComposite)
                 {
                     CompositeType composite = (CompositeType)cfm.comparator;
                     Map<String, String> opts = new HashMap<String, String>();
-                    opts.put(CompositesIndex.PREFIX_SIZE_OPTION, String.valueOf(composite.types.size()
- 1));
+                    opts.put(CompositesIndex.PREFIX_SIZE_OPTION, String.valueOf(composite.types.size()
- (cfDef.hasCollections ? 2 : 1)));
                     cd.setIndexType(IndexType.COMPOSITES, opts);
                 }
                 else


Mime
View raw message