Merge branch 'cassandra-2.1' into trunk

Conflicts:
        src/java/org/apache/cassandra/cql/QueryProcessor.java
        src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
        test/unit/org/apache/cassandra/db/CleanupTest.java
        test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
        test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java


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

Branch: refs/heads/trunk
Commit: 525ac00c0fca71632fa9bb97b2a8b9e844b9850c
Parents: 72d187c 5117a5d
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Tue Nov 4 10:39:36 2014 -0600
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Tue Nov 4 10:39:36 2014 -0600

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 pylib/cqlshlib/cql3handling.py                  |  4 +-
 .../org/apache/cassandra/config/CFMetaData.java |  2 +-
 .../cassandra/config/ColumnDefinition.java      | 12 +++
 .../apache/cassandra/cql3/ColumnCondition.java  | 98 ++++++++++----------
 src/java/org/apache/cassandra/cql3/Cql.g        | 18 ++--
 .../cassandra/cql3/MultiColumnRelation.java     | 14 +--
 .../org/apache/cassandra/cql3/Operator.java     | 93 +++++++++++++++++++
 .../org/apache/cassandra/cql3/Relation.java     | 45 +--------
 .../cassandra/cql3/SingleColumnRelation.java    | 18 ++--
 .../cql3/statements/CreateIndexStatement.java   |  6 +-
 .../cql3/statements/ModificationStatement.java  |  4 +-
 .../cassandra/cql3/statements/Restriction.java  | 12 ++-
 .../cql3/statements/SelectStatement.java        | 53 ++++++-----
 .../statements/SingleColumnRestriction.java     | 17 ++--
 .../apache/cassandra/db/IndexExpression.java    | 89 ++++++++++--------
 .../apache/cassandra/db/PagedRangeCommand.java  | 10 +-
 .../apache/cassandra/db/RangeSliceCommand.java  | 11 +--
 .../cassandra/db/filter/ExtendedFilter.java     | 31 ++++---
 .../cassandra/db/index/SecondaryIndex.java      | 18 ++++
 .../db/index/SecondaryIndexManager.java         |  2 +-
 .../db/index/SecondaryIndexSearcher.java        |  7 +-
 .../db/index/composites/CompositesIndex.java    |  9 +-
 .../CompositesIndexOnCollectionKey.java         |  8 ++
 .../CompositesIndexOnCollectionValue.java       |  7 ++
 .../cassandra/db/marshal/CollectionType.java    |  9 ++
 .../cassandra/db/marshal/CompositeType.java     |  4 +-
 .../cassandra/thrift/ThriftConversion.java      |  3 +-
 .../cassandra/cql3/ColumnConditionTest.java     | 48 +++++-----
 .../cassandra/cql3/ContainsRelationTest.java    | 44 +++++++++
 .../org/apache/cassandra/db/CleanupTest.java    | 11 ++-
 .../cassandra/db/ColumnFamilyStoreTest.java     | 47 +++++-----
 .../cassandra/io/sstable/SSTableReaderTest.java |  3 +-
 .../streaming/StreamingTransferTest.java        |  3 +-
 34 files changed, 473 insertions(+), 289 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 61d6226,7fb32fe..327bfef
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,37 -1,6 +1,39 @@@
 +3.0
 + * Mark sstables as repaired after full repair (CASSANDRA-7586) 
 + * Extend Descriptor to include a format value and refactor reader/writer 
apis (CASSANDRA-7443)
 + * Integrate JMH for microbenchmarks (CASSANDRA-8151)
 + * Keep sstable levels when bootstrapping (CASSANDRA-7460)
 + * Add Sigar library and perform basic OS settings check on startup 
(CASSANDRA-7838)
 + * Support for aggregation functions (CASSANDRA-4914)
 + * Remove cassandra-cli (CASSANDRA-7920)
 + * Accept dollar quoted strings in CQL (CASSANDRA-7769)
 + * Make assassinate a first class command (CASSANDRA-7935)
 + * Support IN clause on any clustering column (CASSANDRA-4762)
 + * Improve compaction logging (CASSANDRA-7818)
 + * Remove YamlFileNetworkTopologySnitch (CASSANDRA-7917)
 + * Do anticompaction in groups (CASSANDRA-6851)
 + * Support pure user-defined functions (CASSANDRA-7395, 7526, 7562, 7740, 
7781, 7929,
 +   7924, 7812, 8063)
 + * Permit configurable timestamps with cassandra-stress (CASSANDRA-7416)
 + * Move sstable RandomAccessReader to nio2, which allows using the
 +   FILE_SHARE_DELETE flag on Windows (CASSANDRA-4050)
 + * Remove CQL2 (CASSANDRA-5918)
 + * Add Thrift get_multi_slice call (CASSANDRA-6757)
 + * Optimize fetching multiple cells by name (CASSANDRA-6933)
 + * Allow compilation in java 8 (CASSANDRA-7028)
 + * Make incremental repair default (CASSANDRA-7250)
 + * Enable code coverage thru JaCoCo (CASSANDRA-7226)
 + * Switch external naming of 'column families' to 'tables' (CASSANDRA-4369) 
 + * Shorten SSTable path (CASSANDRA-6962)
 + * Use unsafe mutations for most unit tests (CASSANDRA-6969)
 + * Fix race condition during calculation of pending ranges (CASSANDRA-7390)
 + * Fail on very large batch sizes (CASSANDRA-8011)
 + * improve concurrency of repair (CASSANDRA-6455)
 +
 +
  2.1.2
+  * Fix issues with CONTAINS (KEY) queries on secondary indexes
+    (CASSANDRA-8147)
   * Fix read-rate tracking of sstables for some queries (CASSANDRA-8239)
   * Fix default timestamp in QueryOptions (CASSANDRA-8246)
   * Set socket timeout when reading remote version (CASSANDRA-8188)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/src/java/org/apache/cassandra/config/ColumnDefinition.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/src/java/org/apache/cassandra/cql3/ColumnCondition.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/src/java/org/apache/cassandra/cql3/Cql.g
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
index 3e4ba96,aa01c93..de9da86
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@@ -822,16 -840,36 +823,16 @@@ public class SelectStatement implement
              }
              if (r.isSlice())
              {
 -                builder.add(getSliceValue(r, b, options));
 -                Operator relType = 
((Restriction.Slice)r).getRelation(eocBound, b);
 -                return 
Collections.singletonList(builder.build().withEOC(eocForRelation(relType)));
 +                compositeBuilder.addElementToAll(getSliceValue(r, b, 
options));
-                 Relation.Type relType = ((Restriction.Slice) 
r).getRelation(eocBound, b);
++                Operator relType = ((Restriction.Slice) 
r).getRelation(eocBound, b);
 +                return compositeBuilder.buildWithEOC(eocForRelation(relType));
              }
 -            else
 -            {
 -                List<ByteBuffer> values = r.values(options);
 -                if (values.size() != 1)
 -                {
 -                    // IN query, we only support it on the clustering columns
 -                    assert def.position() == defs.size() - 1;
 -                    // The IN query might not have listed the values in 
comparator order, so we need to re-sort
 -                    // the bounds lists to make sure the slices works 
correctly (also, to avoid duplicates).
 -                    TreeSet<Composite> s = new TreeSet<>(isReversed ? 
type.reverseComparator() : type);
 -                    for (ByteBuffer val : values)
 -                    {
 -                        if (val == null)
 -                            throw new 
InvalidRequestException(String.format("Invalid null clustering key part %s", 
def.name));
 -                        Composite prefix = builder.buildWith(val);
 -                        // See below for why this
 -                        s.add((eocBound == Bound.END && 
builder.remainingCount() > 0) ? prefix.end() : prefix);
 -                    }
 -                    return new ArrayList<>(s);
 -                }
  
 -                ByteBuffer val = values.get(0);
 -                if (val == null)
 -                    throw new InvalidRequestException(String.format("Invalid 
null clustering key part %s", def.name));
 -                builder.add(val);
 -            }
 +            compositeBuilder.addEachElementToAll(r.values(options));
 +
 +            if (compositeBuilder.containsNull())
 +                throw new InvalidRequestException(
 +                        String.format("Invalid null clustering key part %s", 
def.name));
          }
          // Means no relation at all or everything was an equal
          // Note: if the builder is "full", there is no need to use the 
end-of-component bit. For columns selection,
@@@ -839,11 -877,11 +840,11 @@@
          // with 2ndary index is done, and with the the partition provided 
with an EQ, we'll end up here, and in that
          // case using the eoc would be bad, since for the random partitioner 
we have no guarantee that
          // prefix.end() will sort after prefix (see #5240).
 -        Composite prefix = builder.build();
 -        return Collections.singletonList(eocBound == Bound.END && 
builder.remainingCount() > 0 ? prefix.end() : prefix);
 +        EOC eoc = eocBound == Bound.END && compositeBuilder.hasRemaining() ? 
EOC.END : EOC.NONE;
 +        return compositeBuilder.buildWithEOC(eoc);
      }
  
-     private static Composite.EOC eocForRelation(Relation.Type op)
+     private static Composite.EOC eocForRelation(Operator op)
      {
          switch (op)
          {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/index/SecondaryIndex.java
index c50019a,e2bafaa..b52b6a2
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java
@@@ -26,8 -26,8 +26,9 @@@ import java.util.concurrent.ConcurrentH
  import java.util.concurrent.Future;
  import java.util.concurrent.FutureTask;
  
 +import org.apache.cassandra.io.sstable.format.SSTableReader;
  import org.apache.commons.lang3.StringUtils;
+ 
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/test/unit/org/apache/cassandra/cql3/ContainsRelationTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/test/unit/org/apache/cassandra/db/CleanupTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/CleanupTest.java
index 21de96f,06f8997..5d2217b
--- a/test/unit/org/apache/cassandra/db/CleanupTest.java
+++ b/test/unit/org/apache/cassandra/db/CleanupTest.java
@@@ -29,12 -28,14 +28,16 @@@ import java.util.List
  import java.util.concurrent.ExecutionException;
  import java.util.concurrent.TimeUnit;
  
++import org.junit.BeforeClass;
+ import org.junit.Test;
+ 
  import org.apache.cassandra.SchemaLoader;
  import org.apache.cassandra.Util;
 +import org.apache.cassandra.config.KSMetaData;
+ import org.apache.cassandra.cql3.Operator;
 +import org.apache.cassandra.db.filter.IDiskAtomFilter;
  import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
  import org.apache.cassandra.db.compaction.CompactionManager;
 -import org.apache.cassandra.db.filter.IDiskAtomFilter;
  import org.apache.cassandra.db.index.SecondaryIndex;
  import org.apache.cassandra.dht.BytesToken;
  import org.apache.cassandra.dht.Range;
@@@ -44,13 -43,13 +47,13 @@@ import org.apache.cassandra.locator.Sim
  import org.apache.cassandra.locator.TokenMetadata;
  import org.apache.cassandra.service.StorageService;
  import org.apache.cassandra.utils.ByteBufferUtil;
- import org.junit.BeforeClass;
- import org.junit.Test;
+ 
+ import static org.junit.Assert.assertEquals;
  
 -public class CleanupTest extends SchemaLoader
 +public class CleanupTest
  {
      public static final int LOOPS = 200;
 -    public static final String KEYSPACE1 = "Keyspace1";
 +    public static final String KEYSPACE1 = "CleanupTest1";
      public static final String CF1 = "Indexed1";
      public static final String CF2 = "Standard1";
      public static final ByteBuffer COLUMN = ByteBufferUtil.bytes("birthdate");

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index 0b07e1a,243b2d2..bdb5670
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@@ -55,7 -51,12 +55,8 @@@ import org.junit.runner.RunWith
  import org.apache.cassandra.OrderedJUnit4ClassRunner;
  import org.apache.cassandra.SchemaLoader;
  import org.apache.cassandra.Util;
 -import org.apache.cassandra.config.CFMetaData;
 -import org.apache.cassandra.config.ColumnDefinition;
 -import org.apache.cassandra.config.DatabaseDescriptor;
 -import org.apache.cassandra.config.IndexType;
 -import org.apache.cassandra.config.Schema;
 +import org.apache.cassandra.config.*;
+ import org.apache.cassandra.cql3.Operator;
  import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
  import org.apache.cassandra.db.composites.CellName;
  import org.apache.cassandra.db.composites.CellNameType;
@@@ -255,28 -215,28 +256,28 @@@ public class ColumnFamilyStoreTes
          CellName nobirthdate = cellname("notbirthdate");
          CellName birthdate = cellname("birthdate");
  
 -        rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k1"));
 -        rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(1L), 0);
 -        rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
 -        rm.apply();
 +        rm = new Mutation(KEYSPACE1, ByteBufferUtil.bytes("k1"));
 +        rm.add(CF_INDEX1, nobirthdate, ByteBufferUtil.bytes(1L), 0);
 +        rm.add(CF_INDEX1, birthdate, ByteBufferUtil.bytes(1L), 0);
 +        rm.applyUnsafe();
  
 -        rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k2"));
 -        rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(2L), 0);
 -        rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(2L), 0);
 -        rm.apply();
 +        rm = new Mutation(KEYSPACE1, ByteBufferUtil.bytes("k2"));
 +        rm.add(CF_INDEX1, nobirthdate, ByteBufferUtil.bytes(2L), 0);
 +        rm.add(CF_INDEX1, birthdate, ByteBufferUtil.bytes(2L), 0);
 +        rm.applyUnsafe();
  
 -        rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k3"));
 -        rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(2L), 0);
 -        rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
 -        rm.apply();
 +        rm = new Mutation(KEYSPACE1, ByteBufferUtil.bytes("k3"));
 +        rm.add(CF_INDEX1, nobirthdate, ByteBufferUtil.bytes(2L), 0);
 +        rm.add(CF_INDEX1, birthdate, ByteBufferUtil.bytes(1L), 0);
 +        rm.applyUnsafe();
  
 -        rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("k4aaaa"));
 -        rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(2L), 0);
 -        rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(3L), 0);
 -        rm.apply();
 +        rm = new Mutation(KEYSPACE1, ByteBufferUtil.bytes("k4aaaa"));
 +        rm.add(CF_INDEX1, nobirthdate, ByteBufferUtil.bytes(2L), 0);
 +        rm.add(CF_INDEX1, birthdate, ByteBufferUtil.bytes(3L), 0);
 +        rm.applyUnsafe();
  
          // basic single-expression query
-         IndexExpression expr = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexExpression.Operator.EQ, 
ByteBufferUtil.bytes(1L));
+         IndexExpression expr = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), Operator.EQ, 
ByteBufferUtil.bytes(1L));
          List<IndexExpression> clause = Arrays.asList(expr);
          IDiskAtomFilter filter = new IdentityQueryFilter();
          Range<RowPosition> range = Util.range("", "");
@@@ -363,14 -323,14 +364,14 @@@
      @Test
      public void testIndexDeletions() throws IOException
      {
 -        ColumnFamilyStore cfs = 
Keyspace.open("Keyspace3").getColumnFamilyStore("Indexed1");
 +        ColumnFamilyStore cfs = 
Keyspace.open(KEYSPACE3).getColumnFamilyStore(CF_INDEX1);
          Mutation rm;
  
 -        rm = new Mutation("Keyspace3", ByteBufferUtil.bytes("k1"));
 -        rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(1L), 
0);
 -        rm.apply();
 +        rm = new Mutation(KEYSPACE3, ByteBufferUtil.bytes("k1"));
 +        rm.add(CF_INDEX1, cellname("birthdate"), ByteBufferUtil.bytes(1L), 0);
 +        rm.applyUnsafe();
  
-         IndexExpression expr = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexExpression.Operator.EQ, 
ByteBufferUtil.bytes(1L));
+         IndexExpression expr = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), Operator.EQ, 
ByteBufferUtil.bytes(1L));
          List<IndexExpression> clause = Arrays.asList(expr);
          IDiskAtomFilter filter = new IdentityQueryFilter();
          Range<RowPosition> range = Util.range("", "");
@@@ -463,23 -423,23 +464,23 @@@
  
          // create a row and update the birthdate value, test that the index 
query fetches the new version
          Mutation rm;
 -        rm = new Mutation("Keyspace2", ByteBufferUtil.bytes("k1"));
 -        rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 1);
 -        rm.apply();
 -        rm = new Mutation("Keyspace2", ByteBufferUtil.bytes("k1"));
 -        rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(2L), 2);
 -        rm.apply();
 +        rm = new Mutation(KEYSPACE2, ByteBufferUtil.bytes("k1"));
 +        rm.add(CF_INDEX1, birthdate, ByteBufferUtil.bytes(1L), 1);
 +        rm.applyUnsafe();
 +        rm = new Mutation(KEYSPACE2, ByteBufferUtil.bytes("k1"));
 +        rm.add(CF_INDEX1, birthdate, ByteBufferUtil.bytes(2L), 2);
 +        rm.applyUnsafe();
  
-         IndexExpression expr = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexExpression.Operator.EQ, 
ByteBufferUtil.bytes(1L));
+         IndexExpression expr = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), Operator.EQ, 
ByteBufferUtil.bytes(1L));
          List<IndexExpression> clause = Arrays.asList(expr);
          IDiskAtomFilter filter = new IdentityQueryFilter();
          Range<RowPosition> range = Util.range("", "");
          List<Row> rows = cfs.search(range, clause, filter, 100);
          assert rows.size() == 0;
  
-         expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), 
IndexExpression.Operator.EQ, ByteBufferUtil.bytes(2L));
+         expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), 
Operator.EQ, ByteBufferUtil.bytes(2L));
          clause = Arrays.asList(expr);
 -        rows = keyspace.getColumnFamilyStore("Indexed1").search(range, 
clause, filter, 100);
 +        rows = keyspace.getColumnFamilyStore(CF_INDEX1).search(range, clause, 
filter, 100);
          String key = ByteBufferUtil.string(rows.get(0).key.getKey());
          assert "k1".equals( key );
  
@@@ -502,11 -462,11 +503,11 @@@
  
          // create a row and update the birthdate value with an expiring column
          Mutation rm;
 -        rm = new Mutation("Keyspace2", ByteBufferUtil.bytes("k100"));
 +        rm = new Mutation(KEYSPACE2, ByteBufferUtil.bytes("k100"));
          rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(100L), 
1, 1000);
 -        rm.apply();
 +        rm.applyUnsafe();
  
-         IndexExpression expr = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexExpression.Operator.EQ, 
ByteBufferUtil.bytes(100L));
+         IndexExpression expr = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), Operator.EQ, 
ByteBufferUtil.bytes(100L));
          List<IndexExpression> clause = Arrays.asList(expr);
          IDiskAtomFilter filter = new IdentityQueryFilter();
          Range<RowPosition> range = Util.range("", "");
@@@ -525,11 -485,11 +526,11 @@@
          assertEquals(1, rows.size());
  
          // check that modifying the indexed value using the same timestamp 
behaves as expected
 -        rm = new Mutation("Keyspace2", ByteBufferUtil.bytes("k101"));
 +        rm = new Mutation(KEYSPACE2, ByteBufferUtil.bytes("k101"));
          rm.add("Indexed1", cellname("birthdate"), ByteBufferUtil.bytes(101L), 
1, 1000);
 -        rm.apply();
 +        rm.applyUnsafe();
  
-         expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), 
IndexExpression.Operator.EQ, ByteBufferUtil.bytes(101L));
+         expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), 
Operator.EQ, ByteBufferUtil.bytes(101L));
          clause = Arrays.asList(expr);
          rows = keyspace.getColumnFamilyStore("Indexed1").search(range, 
clause, filter, 100);
          assertEquals(1, rows.size());
@@@ -567,8 -527,8 +568,8 @@@
          Mutation rm;
          rm = new Mutation(keySpace, rowKey);
          rm.add(cfName, colName, val1, 0);
 -        rm.apply();
 +        rm.applyUnsafe();
-         IndexExpression expr = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexExpression.Operator.EQ, 
val1);
+         IndexExpression expr = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), Operator.EQ, val1);
          List<IndexExpression> clause = Arrays.asList(expr);
          IDiskAtomFilter filter = new IdentityQueryFilter();
          Range<RowPosition> range = Util.range("", "");
@@@ -635,10 -595,10 +636,10 @@@
          Mutation rm;
          rm = new Mutation(keySpace, rowKey);
          rm.add(cfName, compositeName, val1, 0);
 -        rm.apply();
 +        rm.applyUnsafe();
  
          // test that the index query fetches this version
-         IndexExpression expr = new IndexExpression(colName, 
IndexExpression.Operator.EQ, val1);
+         IndexExpression expr = new IndexExpression(colName, Operator.EQ, 
val1);
          List<IndexExpression> clause = Arrays.asList(expr);
          IDiskAtomFilter filter = new IdentityQueryFilter();
          Range<RowPosition> range = Util.range("", "");
@@@ -739,29 -699,29 +740,29 @@@
          CellName nobirthdate = cellname("notbirthdate");
          CellName birthdate = cellname("birthdate");
  
 -        rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("kk1"));
 -        rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(1L), 0);
 -        rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
 -        rm.apply();
 +        rm = new Mutation(KEYSPACE1, ByteBufferUtil.bytes("kk1"));
 +        rm.add(CF_INDEX1, nobirthdate, ByteBufferUtil.bytes(1L), 0);
 +        rm.add(CF_INDEX1, birthdate, ByteBufferUtil.bytes(1L), 0);
 +        rm.applyUnsafe();
  
 -        rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("kk2"));
 -        rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(2L), 0);
 -        rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
 -        rm.apply();
 +        rm = new Mutation(KEYSPACE1, ByteBufferUtil.bytes("kk2"));
 +        rm.add(CF_INDEX1, nobirthdate, ByteBufferUtil.bytes(2L), 0);
 +        rm.add(CF_INDEX1, birthdate, ByteBufferUtil.bytes(1L), 0);
 +        rm.applyUnsafe();
  
 -        rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("kk3"));
 -        rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(2L), 0);
 -        rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
 -        rm.apply();
 +        rm = new Mutation(KEYSPACE1, ByteBufferUtil.bytes("kk3"));
 +        rm.add(CF_INDEX1, nobirthdate, ByteBufferUtil.bytes(2L), 0);
 +        rm.add(CF_INDEX1, birthdate, ByteBufferUtil.bytes(1L), 0);
 +        rm.applyUnsafe();
  
 -        rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("kk4"));
 -        rm.add("Indexed1", nobirthdate, ByteBufferUtil.bytes(2L), 0);
 -        rm.add("Indexed1", birthdate, ByteBufferUtil.bytes(1L), 0);
 -        rm.apply();
 +        rm = new Mutation(KEYSPACE1, ByteBufferUtil.bytes("kk4"));
 +        rm.add(CF_INDEX1, nobirthdate, ByteBufferUtil.bytes(2L), 0);
 +        rm.add(CF_INDEX1, birthdate, ByteBufferUtil.bytes(1L), 0);
 +        rm.applyUnsafe();
  
          // basic single-expression query
-         IndexExpression expr1 = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexExpression.Operator.EQ, 
ByteBufferUtil.bytes(1L));
-         IndexExpression expr2 = new 
IndexExpression(ByteBufferUtil.bytes("notbirthdate"), 
IndexExpression.Operator.GT, ByteBufferUtil.bytes(1L));
+         IndexExpression expr1 = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), Operator.EQ, 
ByteBufferUtil.bytes(1L));
+         IndexExpression expr2 = new 
IndexExpression(ByteBufferUtil.bytes("notbirthdate"), Operator.GT, 
ByteBufferUtil.bytes(1L));
          List<IndexExpression> clause = Arrays.asList(expr1, expr2);
          IDiskAtomFilter filter = new IdentityQueryFilter();
          Range<RowPosition> range = Util.range("", "");
@@@ -805,10 -765,10 +806,10 @@@
  
      private void queryBirthdate(Keyspace keyspace) throws 
CharacterCodingException
      {
-         IndexExpression expr = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexExpression.Operator.EQ, 
ByteBufferUtil.bytes(1L));
+         IndexExpression expr = new 
IndexExpression(ByteBufferUtil.bytes("birthdate"), Operator.EQ, 
ByteBufferUtil.bytes(1L));
          List<IndexExpression> clause = Arrays.asList(expr);
          IDiskAtomFilter filter = new IdentityQueryFilter();
 -        List<Row> rows = 
keyspace.getColumnFamilyStore("Indexed2").search(Util.range("", ""), clause, 
filter, 100);
 +        List<Row> rows = 
keyspace.getColumnFamilyStore(CF_INDEX2).search(Util.range("", ""), clause, 
filter, 100);
          assert rows.size() == 1 : StringUtils.join(rows, ",");
          assertEquals("k1", ByteBufferUtil.string(rows.get(0).key.getKey()));
      }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/525ac00c/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
index 6bc6827,5d44210..287a3a1
--- a/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
+++ b/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
@@@ -36,9 -35,8 +36,10 @@@ import org.slf4j.LoggerFactory
  import org.apache.cassandra.OrderedJUnit4ClassRunner;
  import org.apache.cassandra.SchemaLoader;
  import org.apache.cassandra.Util;
 +import org.apache.cassandra.config.CFMetaData;
  import org.apache.cassandra.config.DatabaseDescriptor;
 +import org.apache.cassandra.config.KSMetaData;
+ import org.apache.cassandra.cql3.Operator;
  import org.apache.cassandra.db.*;
  import org.apache.cassandra.db.columniterator.IdentityQueryFilter;
  import org.apache.cassandra.db.context.CounterContext;

Reply via email to