cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stefa...@apache.org
Subject [6/6] cassandra git commit: Merge branch 'cassandra-3.11' into trunk
Date Wed, 02 Aug 2017 02:24:26 GMT
Merge branch 'cassandra-3.11' into trunk


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

Branch: refs/heads/trunk
Commit: 8174fa510cd9007bba1f3726203fabf15b608d61
Parents: fbcec0c 6d1c228
Author: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Authored: Wed Aug 2 10:18:43 2017 +0800
Committer: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Committed: Wed Aug 2 10:20:15 2017 +0800

----------------------------------------------------------------------
 .../db/AbstractReadCommandBuilder.java          |  7 ++++
 .../cassandra/db/PartitionRangeReadCommand.java |  3 +-
 .../db/SinglePartitionReadCommand.java          |  3 +-
 .../db/filter/ClusteringIndexNamesFilter.java   |  4 ++-
 .../validation/operations/SelectLimitTest.java  | 37 ++++++++++++++++++++
 .../cassandra/db/PartitionRangeReadTest.java    | 37 ++++++++++++++++++--
 6 files changed, 86 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8174fa51/src/java/org/apache/cassandra/db/AbstractReadCommandBuilder.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/AbstractReadCommandBuilder.java
index 5a049d3,9290d6c..8ced1c7
--- a/src/java/org/apache/cassandra/db/AbstractReadCommandBuilder.java
+++ b/src/java/org/apache/cassandra/db/AbstractReadCommandBuilder.java
@@@ -189,6 -189,13 +189,13 @@@ public abstract class AbstractReadComma
  
      protected ClusteringIndexFilter makeFilter()
      {
+         // StatementRestrictions.isColumnRange() returns false for static compact tables,
which means
+         // SelectStatement.makeClusteringIndexFilter uses a names filter with no clusterings
for static
+         // compact tables, here we reproduce this behavior (CASSANDRA-11223). Note that
this code is only
+         // called by tests.
 -        if (cfs.metadata.isStaticCompactTable())
 -            return new ClusteringIndexNamesFilter(new TreeSet<>(cfs.metadata.comparator),
reversed);
++        if (cfs.metadata().isStaticCompactTable())
++            return new ClusteringIndexNamesFilter(new TreeSet<>(cfs.metadata().comparator),
reversed);
+ 
          if (clusterings != null)
          {
              return new ClusteringIndexNamesFilter(clusterings, reversed);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8174fa51/src/java/org/apache/cassandra/db/PartitionRangeReadCommand.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8174fa51/src/java/org/apache/cassandra/db/SinglePartitionReadCommand.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8174fa51/src/java/org/apache/cassandra/db/filter/ClusteringIndexNamesFilter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8174fa51/test/unit/org/apache/cassandra/db/PartitionRangeReadTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/PartitionRangeReadTest.java
index c433d8e,c6968da..9ae6c75
--- a/test/unit/org/apache/cassandra/db/PartitionRangeReadTest.java
+++ b/test/unit/org/apache/cassandra/db/PartitionRangeReadTest.java
@@@ -30,12 -30,14 +30,14 @@@ import static org.junit.Assert.assertEq
  import static org.junit.Assert.assertTrue;
  
  import org.apache.cassandra.*;
- import org.apache.cassandra.schema.ColumnMetadata;
 -import org.apache.cassandra.config.CFMetaData;
 -import org.apache.cassandra.config.ColumnDefinition;
+ import org.apache.cassandra.db.marshal.AsciiType;
  import org.apache.cassandra.db.rows.Row;
  import org.apache.cassandra.db.marshal.IntegerType;
  import org.apache.cassandra.db.partitions.*;
  import org.apache.cassandra.exceptions.ConfigurationException;
++import org.apache.cassandra.schema.ColumnMetadata;
  import org.apache.cassandra.schema.KeyspaceParams;
++import org.apache.cassandra.schema.TableMetadata;
  import org.apache.cassandra.utils.ByteBufferUtil;
  
  public class PartitionRangeReadTest
@@@ -52,7 -55,13 +55,13 @@@
          SchemaLoader.createKeyspace(KEYSPACE1,
                                      KeyspaceParams.simple(1),
                                      SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARD1),
-                                     SchemaLoader.denseCFMD(KEYSPACE1, CF_STANDARDINT, IntegerType.instance));
+                                     SchemaLoader.denseCFMD(KEYSPACE1, CF_STANDARDINT, IntegerType.instance),
 -                                    CFMetaData.Builder.create(KEYSPACE1, CF_COMPACT1, false,
false, false)
 -                                                      .addPartitionKey("key", AsciiType.instance)
 -                                                      .addClusteringColumn("column1", AsciiType.instance)
 -                                                      .addRegularColumn("value", AsciiType.instance)
 -                                                      .addStaticColumn("val", AsciiType.instance)
 -                                                      .build());
++                                    TableMetadata.builder(KEYSPACE1, CF_COMPACT1)
++                                                 .isCompound(false)
++                                                 .addPartitionKeyColumn("key", AsciiType.instance)
++                                                 .addClusteringColumn("column1", AsciiType.instance)
++                                                 .addRegularColumn("value", AsciiType.instance)
++                                                 .addStaticColumn("val", AsciiType.instance));
          SchemaLoader.createKeyspace(KEYSPACE2,
                                      KeyspaceParams.simple(1),
                                      SchemaLoader.standardCFMD(KEYSPACE2, CF_STANDARD1));
@@@ -109,6 -118,30 +118,30 @@@
      }
  
      @Test
+     public void testLimits()
+     {
+         ColumnFamilyStore cfs = Keyspace.open(KEYSPACE1).getColumnFamilyStore(CF_COMPACT1);
+         for (int i = 0; i < 10; i++)
+         {
 -            new RowUpdateBuilder(cfs.metadata, 0, Integer.toString(i))
++            new RowUpdateBuilder(cfs.metadata(), 0, Integer.toString(i))
+             .add("val", "abcd")
+             .build()
+             .applyUnsafe();
+ 
 -            new RowUpdateBuilder(cfs.metadata, 0, Integer.toString(i))
++            new RowUpdateBuilder(cfs.metadata(), 0, Integer.toString(i))
+             .clustering("column1")
+             .add("value", "")
+             .build()
+             .applyUnsafe();
+         }
+ 
+         assertEquals(10, Util.getAll(Util.cmd(cfs).build()).size());
+ 
+         for (int i = 0; i < 10; i++)
+             assertEquals(i, Util.getAll(Util.cmd(cfs).withLimit(i).build()).size());
+     }
+ 
+     @Test
      public void testRangeSliceInclusionExclusion() throws Throwable
      {
          String keyspaceName = KEYSPACE1;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message