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 2017/01/27 22:18:17 UTC
[11/37] cassandra git commit: Make TableMetadata immutable,
optimize Schema
http://git-wip-us.apache.org/repos/asf/cassandra/blob/af3fe39d/test/unit/org/apache/cassandra/cql3/restrictions/ClusteringColumnRestrictionsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/restrictions/ClusteringColumnRestrictionsTest.java b/test/unit/org/apache/cassandra/cql3/restrictions/ClusteringColumnRestrictionsTest.java
index 83c00d0..35adff3 100644
--- a/test/unit/org/apache/cassandra/cql3/restrictions/ClusteringColumnRestrictionsTest.java
+++ b/test/unit/org/apache/cassandra/cql3/restrictions/ClusteringColumnRestrictionsTest.java
@@ -24,8 +24,8 @@ import com.google.common.collect.Iterables;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.apache.cassandra.config.CFMetaData;
-import org.apache.cassandra.config.ColumnDefinition;
+import org.apache.cassandra.schema.ColumnMetadata;
+import org.apache.cassandra.schema.TableMetadata;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.*;
import org.apache.cassandra.cql3.Term.MultiItemTerminal;
@@ -52,9 +52,9 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithNoRestrictions()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
assertEquals(1, bounds.size());
@@ -71,12 +71,12 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithOneEqRestrictionsAndOneClusteringColumn()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC);
ByteBuffer clustering_0 = ByteBufferUtil.bytes(1);
- Restriction eq = newSingleEq(cfMetaData, 0, clustering_0);
+ Restriction eq = newSingleEq(tableMetadata, 0, clustering_0);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(eq);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -94,12 +94,12 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithOneEqRestrictionsAndTwoClusteringColumns()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC);
ByteBuffer clustering_0 = ByteBufferUtil.bytes(1);
- Restriction eq = newSingleEq(cfMetaData, 0, clustering_0);
+ Restriction eq = newSingleEq(tableMetadata, 0, clustering_0);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(eq);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -121,11 +121,11 @@ public class ClusteringColumnRestrictionsTest
ByteBuffer value2 = ByteBufferUtil.bytes(2);
ByteBuffer value3 = ByteBufferUtil.bytes(3);
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC);
- Restriction in = newSingleIN(cfMetaData, 0, value1, value2, value3);
+ Restriction in = newSingleIN(tableMetadata, 0, value1, value2, value3);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(in);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -147,13 +147,13 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithSliceRestrictionsAndOneClusteringColumn()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
- Restriction slice = newSingleSlice(cfMetaData, 0, Bound.START, false, value1);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction slice = newSingleSlice(tableMetadata, 0, Bound.START, false, value1);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -164,8 +164,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEmptyEnd(get(bounds, 0));
- slice = newSingleSlice(cfMetaData, 0, Bound.START, true, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 0, Bound.START, true, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -176,8 +176,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEmptyEnd(get(bounds, 0));
- slice = newSingleSlice(cfMetaData, 0, Bound.END, true, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 0, Bound.END, true, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -188,8 +188,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), true, value1);
- slice = newSingleSlice(cfMetaData, 0, Bound.END, false, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 0, Bound.END, false, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -200,9 +200,9 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), false, value1);
- slice = newSingleSlice(cfMetaData, 0, Bound.START, false, value1);
- Restriction slice2 = newSingleSlice(cfMetaData, 0, Bound.END, false, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 0, Bound.START, false, value1);
+ Restriction slice2 = newSingleSlice(tableMetadata, 0, Bound.END, false, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -213,9 +213,9 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), false, value2);
- slice = newSingleSlice(cfMetaData, 0, Bound.START, true, value1);
- slice2 = newSingleSlice(cfMetaData, 0, Bound.END, true, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 0, Bound.START, true, value1);
+ slice2 = newSingleSlice(tableMetadata, 0, Bound.END, true, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -233,13 +233,13 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithSliceRestrictionsAndOneDescendingClusteringColumn()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.DESC, Sort.DESC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.DESC, Sort.DESC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
- Restriction slice = newSingleSlice(cfMetaData, 0, Bound.START, false, value1);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction slice = newSingleSlice(tableMetadata, 0, Bound.START, false, value1);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -250,8 +250,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), false, value1);
- slice = newSingleSlice(cfMetaData, 0, Bound.START, true, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 0, Bound.START, true, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -262,8 +262,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), true, value1);
- slice = newSingleSlice(cfMetaData, 0, Bound.END, true, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 0, Bound.END, true, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -274,8 +274,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEmptyEnd(get(bounds, 0));
- slice = newSingleSlice(cfMetaData, 0, Bound.END, false, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 0, Bound.END, false, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -286,9 +286,9 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEmptyEnd(get(bounds, 0));
- slice = newSingleSlice(cfMetaData, 0, Bound.START, false, value1);
- Restriction slice2 = newSingleSlice(cfMetaData, 0, Bound.END, false, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 0, Bound.START, false, value1);
+ Restriction slice2 = newSingleSlice(tableMetadata, 0, Bound.END, false, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -299,9 +299,9 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), false, value1);
- slice = newSingleSlice(cfMetaData, 0, Bound.START, true, value1);
- slice2 = newSingleSlice(cfMetaData, 0, Bound.END, true, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 0, Bound.START, true, value1);
+ slice2 = newSingleSlice(tableMetadata, 0, Bound.END, true, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -319,14 +319,14 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithEqAndInRestrictions()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
ByteBuffer value3 = ByteBufferUtil.bytes(3);
- Restriction eq = newSingleEq(cfMetaData, 0, value1);
- Restriction in = newSingleIN(cfMetaData, 1, value1, value2, value3);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction eq = newSingleEq(tableMetadata, 0, value1);
+ Restriction in = newSingleIN(tableMetadata, 1, value1, value2, value3);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(eq).mergeWith(in);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -348,16 +348,16 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithEqAndSliceRestrictions()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
ByteBuffer value3 = ByteBufferUtil.bytes(3);
- Restriction eq = newSingleEq(cfMetaData, 0, value3);
+ Restriction eq = newSingleEq(tableMetadata, 0, value3);
- Restriction slice = newSingleSlice(cfMetaData, 1, Bound.START, false, value1);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction slice = newSingleSlice(tableMetadata, 1, Bound.START, false, value1);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(eq).mergeWith(slice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -368,8 +368,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), true, value3);
- slice = newSingleSlice(cfMetaData, 1, Bound.START, true, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 1, Bound.START, true, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(eq).mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -380,8 +380,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), true, value3);
- slice = newSingleSlice(cfMetaData, 1, Bound.END, true, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 1, Bound.END, true, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(eq).mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -392,8 +392,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), true, value3, value1);
- slice = newSingleSlice(cfMetaData, 1, Bound.END, false, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 1, Bound.END, false, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(eq).mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -404,9 +404,9 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), false, value3, value1);
- slice = newSingleSlice(cfMetaData, 1, Bound.START, false, value1);
- Restriction slice2 = newSingleSlice(cfMetaData, 1, Bound.END, false, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 1, Bound.START, false, value1);
+ Restriction slice2 = newSingleSlice(tableMetadata, 1, Bound.END, false, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(eq).mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -417,9 +417,9 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), false, value3, value2);
- slice = newSingleSlice(cfMetaData, 1, Bound.START, true, value1);
- slice2 = newSingleSlice(cfMetaData, 1, Bound.END, true, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newSingleSlice(tableMetadata, 1, Bound.START, true, value1);
+ slice2 = newSingleSlice(tableMetadata, 1, Bound.END, true, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(eq).mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -437,12 +437,12 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithMultiEqRestrictions()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
- Restriction eq = newMultiEq(cfMetaData, 0, value1, value2);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction eq = newMultiEq(tableMetadata, 0, value1, value2);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(eq);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -460,13 +460,13 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithMultiInRestrictions()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
ByteBuffer value3 = ByteBufferUtil.bytes(3);
- Restriction in = newMultiIN(cfMetaData, 0, asList(value1, value2), asList(value2, value3));
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction in = newMultiIN(tableMetadata, 0, asList(value1, value2), asList(value2, value3));
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(in);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -486,14 +486,14 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithMultiSliceRestrictionsWithOneClusteringColumn()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
- Restriction slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -504,8 +504,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEmptyEnd(get(bounds, 0));
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -516,8 +516,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEmptyEnd(get(bounds, 0));
- slice = newMultiSlice(cfMetaData, 0, Bound.END, true, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, true, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -528,8 +528,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), true, value1);
- slice = newMultiSlice(cfMetaData, 0, Bound.END, false, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, false, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -540,9 +540,9 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), false, value1);
- slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1);
- Restriction slice2 = newMultiSlice(cfMetaData, 0, Bound.END, false, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1);
+ Restriction slice2 = newMultiSlice(tableMetadata, 0, Bound.END, false, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -553,9 +553,9 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), false, value2);
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1);
- slice2 = newMultiSlice(cfMetaData, 0, Bound.END, true, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1);
+ slice2 = newMultiSlice(tableMetadata, 0, Bound.END, true, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -574,13 +574,13 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithMultiSliceRestrictionsWithOneDescendingClusteringColumn()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.DESC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.DESC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
- Restriction slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -591,8 +591,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), false, value1);
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -603,8 +603,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), true, value1);
- slice = newMultiSlice(cfMetaData, 0, Bound.END, true, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, true, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -615,8 +615,8 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEmptyEnd(get(bounds, 0));
- slice = newMultiSlice(cfMetaData, 0, Bound.END, false, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, false, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -627,9 +627,9 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEmptyEnd(get(bounds, 0));
- slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1);
- Restriction slice2 = newMultiSlice(cfMetaData, 0, Bound.END, false, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1);
+ Restriction slice2 = newMultiSlice(tableMetadata, 0, Bound.END, false, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -640,9 +640,9 @@ public class ClusteringColumnRestrictionsTest
assertEquals(1, bounds.size());
assertEndBound(get(bounds, 0), false, value1);
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1);
- slice2 = newMultiSlice(cfMetaData, 0, Bound.END, true, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1);
+ slice2 = newMultiSlice(tableMetadata, 0, Bound.END, true, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -660,14 +660,14 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithMultiSliceRestrictionsWithTwoClusteringColumn()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
// (clustering_0, clustering1) > (1, 2)
- Restriction slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1, value2);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1, value2);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -679,8 +679,8 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 0));
// (clustering_0, clustering1) >= (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -692,8 +692,8 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 0));
// (clustering_0, clustering1) <= (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.END, true, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, true, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -705,8 +705,8 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), true, value1, value2);
// (clustering_0, clustering1) < (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.END, false, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, false, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -718,9 +718,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), false, value1, value2);
// (clustering_0, clustering1) > (1, 2) AND (clustering_0) < (2)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1, value2);
- Restriction slice2 = newMultiSlice(cfMetaData, 0, Bound.END, false, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1, value2);
+ Restriction slice2 = newMultiSlice(tableMetadata, 0, Bound.END, false, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -732,9 +732,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), false, value2);
// (clustering_0, clustering1) >= (1, 2) AND (clustering_0, clustering1) <= (2, 1)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2);
- slice2 = newMultiSlice(cfMetaData, 0, Bound.END, true, value2, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2);
+ slice2 = newMultiSlice(tableMetadata, 0, Bound.END, true, value2, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -752,14 +752,14 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithMultiSliceRestrictionsWithTwoDescendingClusteringColumns()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.DESC, Sort.DESC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.DESC, Sort.DESC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
// (clustering_0, clustering1) > (1, 2)
- Restriction slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1, value2);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1, value2);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -771,8 +771,8 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), false, value1, value2);
// (clustering_0, clustering1) >= (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -784,8 +784,8 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), true, value1, value2);
// (clustering_0, clustering1) <= (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.END, true, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, true, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -797,8 +797,8 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 0));
// (clustering_0, clustering1) < (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.END, false, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, false, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -811,9 +811,9 @@ public class ClusteringColumnRestrictionsTest
// (clustering_0, clustering1) > (1, 2) AND (clustering_0) < (2)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1, value2);
- Restriction slice2 = newMultiSlice(cfMetaData, 0, Bound.END, false, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1, value2);
+ Restriction slice2 = newMultiSlice(tableMetadata, 0, Bound.END, false, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -825,9 +825,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), false, value1, value2);
// (clustering_0, clustering1) >= (1, 2) AND (clustering_0, clustering1) <= (2, 1)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2);
- slice2 = newMultiSlice(cfMetaData, 0, Bound.END, true, value2, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2);
+ slice2 = newMultiSlice(tableMetadata, 0, Bound.END, true, value2, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -846,14 +846,14 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithMultiSliceRestrictionsWithOneDescendingAndOneAscendingClusteringColumns()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.DESC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.DESC, Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
// (clustering_0, clustering1) > (1, 2)
- Restriction slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1, value2);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1, value2);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -867,8 +867,8 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), true, value1);
// (clustering_0, clustering1) >= (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -882,8 +882,8 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), true, value1);
// (clustering_0, clustering1) <= (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.END, true, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, true, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -897,8 +897,8 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 1));
// (clustering_0, clustering1) < (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.END, false, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, false, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -912,9 +912,9 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 1));
// (clustering_0, clustering1) > (1, 2) AND (clustering_0) < (2)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1, value2);
- Restriction slice2 = newMultiSlice(cfMetaData, 0, Bound.END, false, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1, value2);
+ Restriction slice2 = newMultiSlice(tableMetadata, 0, Bound.END, false, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -928,9 +928,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), true, value1);
// (clustering_0) > (1) AND (clustering_0, clustering1) < (2, 1)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1);
- slice2 = newMultiSlice(cfMetaData, 0, Bound.END, false, value2, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1);
+ slice2 = newMultiSlice(tableMetadata, 0, Bound.END, false, value2, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -944,9 +944,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), false, value1);
// (clustering_0, clustering1) >= (1, 2) AND (clustering_0, clustering1) <= (2, 1)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2);
- slice2 = newMultiSlice(cfMetaData, 0, Bound.END, true, value2, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2);
+ slice2 = newMultiSlice(tableMetadata, 0, Bound.END, true, value2, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -969,14 +969,14 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithMultiSliceRestrictionsWithOneAscendingAndOneDescendingClusteringColumns()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.DESC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.DESC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
// (clustering_0, clustering1) > (1, 2)
- Restriction slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1, value2);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1, value2);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -990,8 +990,8 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 1));
// (clustering_0, clustering1) >= (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1005,8 +1005,8 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 1));
// (clustering_0, clustering1) <= (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.END, true, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, true, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1020,8 +1020,8 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), true, value1);
// (clustering_0, clustering1) < (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.END, false, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, false, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1035,9 +1035,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), true, value1);
// (clustering_0, clustering1) > (1, 2) AND (clustering_0) < (2)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1, value2);
- Restriction slice2 = newMultiSlice(cfMetaData, 0, Bound.END, false, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1, value2);
+ Restriction slice2 = newMultiSlice(tableMetadata, 0, Bound.END, false, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1051,9 +1051,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), false, value2);
// (clustering_0, clustering1) >= (1, 2) AND (clustering_0, clustering1) <= (2, 1)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2);
- slice2 = newMultiSlice(cfMetaData, 0, Bound.END, true, value2, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2);
+ slice2 = newMultiSlice(tableMetadata, 0, Bound.END, true, value2, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1076,7 +1076,7 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithMultiSliceRestrictionsWithTwoAscendingAndTwoDescendingClusteringColumns()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC, Sort.DESC, Sort.DESC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC, Sort.DESC, Sort.DESC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
@@ -1084,8 +1084,8 @@ public class ClusteringColumnRestrictionsTest
ByteBuffer value4 = ByteBufferUtil.bytes(4);
// (clustering_0, clustering1, clustering_2, clustering_3) > (1, 2, 3, 4)
- Restriction slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1, value2, value3, value4);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1, value2, value3, value4);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1099,9 +1099,9 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 1));
// clustering_0 = 1 AND (clustering_1, clustering_2, clustering_3) > (2, 3, 4)
- Restriction eq = newSingleEq(cfMetaData, 0, value1);
- slice = newMultiSlice(cfMetaData, 1, Bound.START, false, value2, value3, value4);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction eq = newSingleEq(tableMetadata, 0, value1);
+ slice = newMultiSlice(tableMetadata, 1, Bound.START, false, value2, value3, value4);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
restrictions = restrictions.mergeWith(eq);
@@ -1116,9 +1116,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), true, value1);
// clustering_0 IN (1, 2) AND (clustering_1, clustering_2, clustering_3) > (2, 3, 4)
- Restriction in = newSingleIN(cfMetaData, 0, value1, value2);
- slice = newMultiSlice(cfMetaData, 1, Bound.START, false, value2, value3, value4);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction in = newSingleIN(tableMetadata, 0, value1, value2);
+ slice = newMultiSlice(tableMetadata, 1, Bound.START, false, value2, value3, value4);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
restrictions = restrictions.mergeWith(in);
@@ -1137,8 +1137,8 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 3), true, value2);
// (clustering_0, clustering1) >= (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1150,8 +1150,8 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 0));
// (clustering_0, clustering1, clustering_2, clustering_3) >= (1, 2, 3, 4)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2, value3, value4);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2, value3, value4);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1165,8 +1165,8 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 1));
// (clustering_0, clustering1, clustering_2, clustering_3) <= (1, 2, 3, 4)
- slice = newMultiSlice(cfMetaData, 0, Bound.END, true, value1, value2, value3, value4);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, true, value1, value2, value3, value4);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1180,8 +1180,8 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), true, value1, value2);
// (clustering_0, clustering1, clustering_2, clustering_3) < (1, 2, 3, 4)
- slice = newMultiSlice(cfMetaData, 0, Bound.END, false, value1, value2, value3, value4);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, false, value1, value2, value3, value4);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1195,9 +1195,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), true, value1, value2);
// (clustering_0, clustering1, clustering_2, clustering_3) > (1, 2, 3, 4) AND (clustering_0, clustering_1) < (2, 3)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1, value2, value3, value4);
- Restriction slice2 = newMultiSlice(cfMetaData, 0, Bound.END, false, value2, value3);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1, value2, value3, value4);
+ Restriction slice2 = newMultiSlice(tableMetadata, 0, Bound.END, false, value2, value3);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1211,9 +1211,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), false, value2, value3);
// (clustering_0, clustering1, clustering_2, clustering_3) >= (1, 2, 3, 4) AND (clustering_0, clustering1, clustering_2, clustering_3) <= (4, 3, 2, 1)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2, value3, value4);
- slice2 = newMultiSlice(cfMetaData, 0, Bound.END, true, value4, value3, value2, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2, value3, value4);
+ slice2 = newMultiSlice(tableMetadata, 0, Bound.END, true, value4, value3, value2, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1236,7 +1236,7 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithMultiSliceRestrictionsWithAscendingDescendingColumnMix()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.DESC, Sort.ASC, Sort.DESC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.DESC, Sort.ASC, Sort.DESC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
@@ -1244,8 +1244,8 @@ public class ClusteringColumnRestrictionsTest
ByteBuffer value4 = ByteBufferUtil.bytes(4);
// (clustering_0, clustering1, clustering_2, clustering_3) > (1, 2, 3, 4)
- Restriction slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1, value2, value3, value4);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1, value2, value3, value4);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1264,9 +1264,9 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 3));
// clustering_0 = 1 AND (clustering_1, clustering_2, clustering_3) > (2, 3, 4)
- Restriction eq = newSingleEq(cfMetaData, 0, value1);
- slice = newMultiSlice(cfMetaData, 1, Bound.START, false, value2, value3, value4);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction eq = newSingleEq(tableMetadata, 0, value1);
+ slice = newMultiSlice(tableMetadata, 1, Bound.START, false, value2, value3, value4);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
restrictions = restrictions.mergeWith(eq);
@@ -1283,8 +1283,8 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 2), true, value1, value2);
// (clustering_0, clustering1) >= (1, 2)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1298,8 +1298,8 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 1));
// (clustering_0, clustering1, clustering_2, clustering_3) >= (1, 2, 3, 4)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2, value3, value4);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2, value3, value4);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1317,8 +1317,8 @@ public class ClusteringColumnRestrictionsTest
assertEmptyEnd(get(bounds, 3));
// (clustering_0, clustering1, clustering_2, clustering_3) <= (1, 2, 3, 4)
- slice = newMultiSlice(cfMetaData, 0, Bound.END, true, value1, value2, value3, value4);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, true, value1, value2, value3, value4);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1336,8 +1336,8 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 3), true, value1);
// (clustering_0, clustering1, clustering_2, clustering_3) < (1, 2, 3, 4)
- slice = newMultiSlice(cfMetaData, 0, Bound.END, false, value1, value2, value3, value4);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.END, false, value1, value2, value3, value4);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1355,9 +1355,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 3), true, value1);
// (clustering_0, clustering1, clustering_2, clustering_3) > (1, 2, 3, 4) AND (clustering_0, clustering_1) < (2, 3)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, false, value1, value2, value3, value4);
- Restriction slice2 = newMultiSlice(cfMetaData, 0, Bound.END, false, value2, value3);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, false, value1, value2, value3, value4);
+ Restriction slice2 = newMultiSlice(tableMetadata, 0, Bound.END, false, value2, value3);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1377,9 +1377,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 4), true, value2);
// (clustering_0, clustering1, clustering_2, clustering_3) >= (1, 2, 3, 4) AND (clustering_0, clustering1, clustering_2, clustering_3) <= (4, 3, 2, 1)
- slice = newMultiSlice(cfMetaData, 0, Bound.START, true, value1, value2, value3, value4);
- slice2 = newMultiSlice(cfMetaData, 0, Bound.END, true, value4, value3, value2, value1);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ slice = newMultiSlice(tableMetadata, 0, Bound.START, true, value1, value2, value3, value4);
+ slice2 = newMultiSlice(tableMetadata, 0, Bound.END, true, value4, value3, value2, value1);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(slice).mergeWith(slice2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1409,7 +1409,7 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithSingleEqAndMultiEqRestrictions()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC, Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC, Sort.ASC, Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
@@ -1417,9 +1417,9 @@ public class ClusteringColumnRestrictionsTest
ByteBuffer value4 = ByteBufferUtil.bytes(4);
// clustering_0 = 1 AND (clustering_1, clustering_2) = (2, 3)
- Restriction singleEq = newSingleEq(cfMetaData, 0, value1);
- Restriction multiEq = newMultiEq(cfMetaData, 1, value2, value3);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction singleEq = newSingleEq(tableMetadata, 0, value1);
+ Restriction multiEq = newMultiEq(tableMetadata, 1, value2, value3);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(singleEq).mergeWith(multiEq);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1431,10 +1431,10 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), true, value1, value2, value3);
// clustering_0 = 1 AND clustering_1 = 2 AND (clustering_2, clustering_3) = (3, 4)
- singleEq = newSingleEq(cfMetaData, 0, value1);
- Restriction singleEq2 = newSingleEq(cfMetaData, 1, value2);
- multiEq = newMultiEq(cfMetaData, 2, value3, value4);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ singleEq = newSingleEq(tableMetadata, 0, value1);
+ Restriction singleEq2 = newSingleEq(tableMetadata, 1, value2);
+ multiEq = newMultiEq(tableMetadata, 2, value3, value4);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(singleEq).mergeWith(singleEq2).mergeWith(multiEq);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1446,9 +1446,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), true, value1, value2, value3, value4);
// (clustering_0, clustering_1) = (1, 2) AND clustering_2 = 3
- singleEq = newSingleEq(cfMetaData, 2, value3);
- multiEq = newMultiEq(cfMetaData, 0, value1, value2);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ singleEq = newSingleEq(tableMetadata, 2, value3);
+ multiEq = newMultiEq(tableMetadata, 0, value1, value2);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(singleEq).mergeWith(multiEq);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1460,10 +1460,10 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), true, value1, value2, value3);
// clustering_0 = 1 AND (clustering_1, clustering_2) = (2, 3) AND clustering_3 = 4
- singleEq = newSingleEq(cfMetaData, 0, value1);
- singleEq2 = newSingleEq(cfMetaData, 3, value4);
- multiEq = newMultiEq(cfMetaData, 1, value2, value3);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ singleEq = newSingleEq(tableMetadata, 0, value1);
+ singleEq2 = newSingleEq(tableMetadata, 3, value4);
+ multiEq = newMultiEq(tableMetadata, 1, value2, value3);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(singleEq).mergeWith(multiEq).mergeWith(singleEq2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1481,7 +1481,7 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithSingleEqAndMultiINRestrictions()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC, Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC, Sort.ASC, Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
@@ -1490,9 +1490,9 @@ public class ClusteringColumnRestrictionsTest
ByteBuffer value5 = ByteBufferUtil.bytes(5);
// clustering_0 = 1 AND (clustering_1, clustering_2) IN ((2, 3), (4, 5))
- Restriction singleEq = newSingleEq(cfMetaData, 0, value1);
- Restriction multiIN = newMultiIN(cfMetaData, 1, asList(value2, value3), asList(value4, value5));
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction singleEq = newSingleEq(tableMetadata, 0, value1);
+ Restriction multiIN = newMultiIN(tableMetadata, 1, asList(value2, value3), asList(value4, value5));
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(singleEq).mergeWith(multiIN);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1506,9 +1506,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), true, value1, value4, value5);
// clustering_0 = 1 AND (clustering_1, clustering_2) IN ((2, 3))
- singleEq = newSingleEq(cfMetaData, 0, value1);
- multiIN = newMultiIN(cfMetaData, 1, asList(value2, value3));
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ singleEq = newSingleEq(tableMetadata, 0, value1);
+ multiIN = newMultiIN(tableMetadata, 1, asList(value2, value3));
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(multiIN).mergeWith(singleEq);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1520,10 +1520,10 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), true, value1, value2, value3);
// clustering_0 = 1 AND clustering_1 = 5 AND (clustering_2, clustering_3) IN ((2, 3), (4, 5))
- singleEq = newSingleEq(cfMetaData, 0, value1);
- Restriction singleEq2 = newSingleEq(cfMetaData, 1, value5);
- multiIN = newMultiIN(cfMetaData, 2, asList(value2, value3), asList(value4, value5));
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ singleEq = newSingleEq(tableMetadata, 0, value1);
+ Restriction singleEq2 = newSingleEq(tableMetadata, 1, value5);
+ multiIN = newMultiIN(tableMetadata, 2, asList(value2, value3), asList(value4, value5));
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(singleEq).mergeWith(multiIN).mergeWith(singleEq2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1544,7 +1544,7 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithSingleEqAndSliceRestrictions()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC, Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
@@ -1553,9 +1553,9 @@ public class ClusteringColumnRestrictionsTest
ByteBuffer value5 = ByteBufferUtil.bytes(5);
// clustering_0 = 1 AND (clustering_1, clustering_2) > (2, 3)
- Restriction singleEq = newSingleEq(cfMetaData, 0, value1);
- Restriction multiSlice = newMultiSlice(cfMetaData, 1, Bound.START, false, value2, value3);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction singleEq = newSingleEq(tableMetadata, 0, value1);
+ Restriction multiSlice = newMultiSlice(tableMetadata, 1, Bound.START, false, value2, value3);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(singleEq).mergeWith(multiSlice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1567,10 +1567,10 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), true, value1);
// clustering_0 = 1 AND (clustering_1, clustering_2) > (2, 3) AND (clustering_1) < (4)
- singleEq = newSingleEq(cfMetaData, 0, value1);
- multiSlice = newMultiSlice(cfMetaData, 1, Bound.START, false, value2, value3);
- Restriction multiSlice2 = newMultiSlice(cfMetaData, 1, Bound.END, false, value4);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ singleEq = newSingleEq(tableMetadata, 0, value1);
+ multiSlice = newMultiSlice(tableMetadata, 1, Bound.START, false, value2, value3);
+ Restriction multiSlice2 = newMultiSlice(tableMetadata, 1, Bound.END, false, value4);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(multiSlice2).mergeWith(singleEq).mergeWith(multiSlice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1582,10 +1582,10 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), false, value1, value4);
// clustering_0 = 1 AND (clustering_1, clustering_2) => (2, 3) AND (clustering_1, clustering_2) <= (4, 5)
- singleEq = newSingleEq(cfMetaData, 0, value1);
- multiSlice = newMultiSlice(cfMetaData, 1, Bound.START, true, value2, value3);
- multiSlice2 = newMultiSlice(cfMetaData, 1, Bound.END, true, value4, value5);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ singleEq = newSingleEq(tableMetadata, 0, value1);
+ multiSlice = newMultiSlice(tableMetadata, 1, Bound.START, true, value2, value3);
+ multiSlice2 = newMultiSlice(tableMetadata, 1, Bound.END, true, value4, value5);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(multiSlice2).mergeWith(singleEq).mergeWith(multiSlice);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1604,16 +1604,16 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithMultiEqAndSingleSliceRestrictions()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC, Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
ByteBuffer value3 = ByteBufferUtil.bytes(3);
// (clustering_0, clustering_1) = (1, 2) AND clustering_2 > 3
- Restriction multiEq = newMultiEq(cfMetaData, 0, value1, value2);
- Restriction singleSlice = newSingleSlice(cfMetaData, 2, Bound.START, false, value3);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction multiEq = newMultiEq(tableMetadata, 0, value1, value2);
+ Restriction singleSlice = newSingleSlice(tableMetadata, 2, Bound.START, false, value3);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(multiEq).mergeWith(singleSlice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1628,7 +1628,7 @@ public class ClusteringColumnRestrictionsTest
@Test
public void testBoundsAsClusteringWithSeveralMultiColumnRestrictions()
{
- CFMetaData cfMetaData = newCFMetaData(Sort.ASC, Sort.ASC, Sort.ASC, Sort.ASC);
+ TableMetadata tableMetadata = newTableMetadata(Sort.ASC, Sort.ASC, Sort.ASC, Sort.ASC);
ByteBuffer value1 = ByteBufferUtil.bytes(1);
ByteBuffer value2 = ByteBufferUtil.bytes(2);
@@ -1637,9 +1637,9 @@ public class ClusteringColumnRestrictionsTest
ByteBuffer value5 = ByteBufferUtil.bytes(5);
// (clustering_0, clustering_1) = (1, 2) AND (clustering_2, clustering_3) > (3, 4)
- Restriction multiEq = newMultiEq(cfMetaData, 0, value1, value2);
- Restriction multiSlice = newMultiSlice(cfMetaData, 2, Bound.START, false, value3, value4);
- ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ Restriction multiEq = newMultiEq(tableMetadata, 0, value1, value2);
+ Restriction multiSlice = newMultiSlice(tableMetadata, 2, Bound.START, false, value3, value4);
+ ClusteringColumnRestrictions restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(multiEq).mergeWith(multiSlice);
SortedSet<ClusteringBound> bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1651,9 +1651,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 0), true, value1, value2);
// (clustering_0, clustering_1) = (1, 2) AND (clustering_2, clustering_3) IN ((3, 4), (4, 5))
- multiEq = newMultiEq(cfMetaData, 0, value1, value2);
- Restriction multiIN = newMultiIN(cfMetaData, 2, asList(value3, value4), asList(value4, value5));
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ multiEq = newMultiEq(tableMetadata, 0, value1, value2);
+ Restriction multiIN = newMultiIN(tableMetadata, 2, asList(value3, value4), asList(value4, value5));
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(multiEq).mergeWith(multiIN);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1667,9 +1667,9 @@ public class ClusteringColumnRestrictionsTest
assertEndBound(get(bounds, 1), true, value1, value2, value4, value5);
// (clustering_0, clustering_1) = (1, 2) AND (clustering_2, clustering_3) = (3, 4)
- multiEq = newMultiEq(cfMetaData, 0, value1, value2);
- Restriction multiEq2 = newMultiEq(cfMetaData, 2, value3, value4);
- restrictions = new ClusteringColumnRestrictions(cfMetaData);
+ multiEq = newMultiEq(tableMetadata, 0, value1, value2);
+ Restriction multiEq2 = newMultiEq(tableMetadata, 2, value3, value4);
+ restrictions = new ClusteringColumnRestrictions(tableMetadata);
restrictions = restrictions.mergeWith(multiEq).mergeWith(multiEq2);
bounds = restrictions.boundsAsClustering(Bound.START, QueryOptions.DEFAULT);
@@ -1741,21 +1741,16 @@ public class ClusteringColumnRestrictionsTest
}
}
- /**
- * Creates a new <code>CFMetaData</code> instance.
- *
- * @param numberOfClusteringColumns the number of clustering column
- * @return a new <code>CFMetaData</code> instance
- */
- private static CFMetaData newCFMetaData(Sort... sorts)
+ private static TableMetadata newTableMetadata(Sort... sorts)
{
List<AbstractType<?>> types = new ArrayList<>();
for (Sort sort : sorts)
types.add(sort == Sort.ASC ? Int32Type.instance : ReversedType.getInstance(Int32Type.instance));
- CFMetaData.Builder builder = CFMetaData.Builder.create("keyspace", "test")
- .addPartitionKey("partition_key", Int32Type.instance);
+ TableMetadata.Builder builder =
+ TableMetadata.builder("keyspace", "test")
+ .addPartitionKeyColumn("partition_key", Int32Type.instance);
for (int i = 0; i < sorts.length; i++)
builder.addClusteringColumn("clustering_" + i, types.get(i));
@@ -1766,116 +1761,116 @@ public class ClusteringColumnRestrictionsTest
/**
* Creates a new <code>SingleColumnRestriction.EQ</code> instance for the specified clustering column.
*
- * @param cfMetaData the column family meta data
+ * @param tableMetadata the column family meta data
* @param index the clustering column index
* @param value the equality value
* @return a new <code>SingleColumnRestriction.EQ</code> instance for the specified clustering column
*/
- private static Restriction newSingleEq(CFMetaData cfMetaData, int index, ByteBuffer value)
+ private static Restriction newSingleEq(TableMetadata tableMetadata, int index, ByteBuffer value)
{
- ColumnDefinition columnDef = getClusteringColumnDefinition(cfMetaData, index);
+ ColumnMetadata columnDef = getClusteringColumnDefinition(tableMetadata, index);
return new SingleColumnRestriction.EQRestriction(columnDef, toTerm(value));
}
/**
* Creates a new <code>MultiColumnRestriction.EQ</code> instance for the specified clustering column.
*
- * @param cfMetaData the column family meta data
- * @param index the clustering column index
- * @param value the equality value
+ * @param tableMetadata the column family meta data
+ * @param firstIndex the clustering column index
+ * @param values the equality value
* @return a new <code>MultiColumnRestriction.EQ</code> instance for the specified clustering column
*/
- private static Restriction newMultiEq(CFMetaData cfMetaData, int firstIndex, ByteBuffer... values)
+ private static Restriction newMultiEq(TableMetadata tableMetadata, int firstIndex, ByteBuffer... values)
{
- List<ColumnDefinition> columnDefinitions = new ArrayList<>();
+ List<ColumnMetadata> columnMetadatas = new ArrayList<>();
for (int i = 0; i < values.length; i++)
{
- columnDefinitions.add(getClusteringColumnDefinition(cfMetaData, firstIndex + i));
+ columnMetadatas.add(getClusteringColumnDefinition(tableMetadata, firstIndex + i));
}
- return new MultiColumnRestriction.EQRestriction(columnDefinitions, toMultiItemTerminal(values));
+ return new MultiColumnRestriction.EQRestriction(columnMetadatas, toMultiItemTerminal(values));
}
/**
* Creates a new <code>MultiColumnRestriction.IN</code> instance for the specified clustering column.
*
- * @param cfMetaData the column family meta data
+ * @param tableMetadata the column family meta data
* @param firstIndex the index of the first clustering column
* @param values the in values
* @return a new <code>MultiColumnRestriction.IN</code> instance for the specified clustering column
*/
@SafeVarargs
- private static Restriction newMultiIN(CFMetaData cfMetaData, int firstIndex, List<ByteBuffer>... values)
+ private static Restriction newMultiIN(TableMetadata tableMetadata, int firstIndex, List<ByteBuffer>... values)
{
- List<ColumnDefinition> columnDefinitions = new ArrayList<>();
+ List<ColumnMetadata> columnMetadatas = new ArrayList<>();
List<Term> terms = new ArrayList<>();
for (int i = 0; i < values.length; i++)
{
- columnDefinitions.add(getClusteringColumnDefinition(cfMetaData, firstIndex + i));
+ columnMetadatas.add(getClusteringColumnDefinition(tableMetadata, firstIndex + i));
terms.add(toMultiItemTerminal(values[i].toArray(new ByteBuffer[0])));
}
- return new MultiColumnRestriction.InRestrictionWithValues(columnDefinitions, terms);
+ return new MultiColumnRestriction.InRestrictionWithValues(columnMetadatas, terms);
}
/**
* Creates a new <code>SingleColumnRestriction.IN</code> instance for the specified clustering column.
*
- * @param cfMetaData the column family meta data
+ * @param tableMetadata the column family meta data
* @param index the clustering column index
* @param values the in values
* @return a new <code>SingleColumnRestriction.IN</code> instance for the specified clustering column
*/
- private static Restriction newSingleIN(CFMetaData cfMetaData, int index, ByteBuffer... values)
+ private static Restriction newSingleIN(TableMetadata tableMetadata, int index, ByteBuffer... values)
{
- ColumnDefinition columnDef = getClusteringColumnDefinition(cfMetaData, index);
+ ColumnMetadata columnDef = getClusteringColumnDefinition(tableMetadata, index);
return new SingleColumnRestriction.InRestrictionWithValues(columnDef, toTerms(values));
}
/**
- * Returns the clustering <code>ColumnDefinition</code> for the specified position.
+ * Returns the clustering <code>ColumnMetadata</code> for the specified position.
*
- * @param cfMetaData the column family meta data
+ * @param tableMetadata the column family meta data
* @param index the clustering column index
- * @return the clustering <code>ColumnDefinition</code> for the specified position.
+ * @return the clustering <code>ColumnMetadata</code> for the specified position.
*/
- private static ColumnDefinition getClusteringColumnDefinition(CFMetaData cfMetaData, int index)
+ private static ColumnMetadata getClusteringColumnDefinition(TableMetadata tableMetadata, int index)
{
- return cfMetaData.clusteringColumns().get(index);
+ return tableMetadata.clusteringColumns().get(index);
}
/**
* Creates a new <code>SingleColumnRestriction.Slice</code> instance for the specified clustering column.
*
- * @param cfMetaData the column family meta data
+ * @param tableMetadata the column family meta data
* @param index the clustering column index
* @param bound the slice bound
* @param inclusive <code>true</code> if the bound is inclusive
* @param value the bound value
* @return a new <code>SingleColumnRestriction.Slice</code> instance for the specified clustering column
*/
- private static Restriction newSingleSlice(CFMetaData cfMetaData, int index, Bound bound, boolean inclusive, ByteBuffer value)
+ private static Restriction newSingleSlice(TableMetadata tableMetadata, int index, Bound bound, boolean inclusive, ByteBuffer value)
{
- ColumnDefinition columnDef = getClusteringColumnDefinition(cfMetaData, index);
+ ColumnMetadata columnDef = getClusteringColumnDefinition(tableMetadata, index);
return new SingleColumnRestriction.SliceRestriction(columnDef, bound, inclusive, toTerm(value));
}
/**
* Creates a new <code>SingleColumnRestriction.Slice</code> instance for the specified clustering column.
*
- * @param cfMetaData the column family meta data
- * @param index the clustering column index
+ * @param tableMetadata the column family meta data
+ * @param firstIndex the clustering column index
* @param bound the slice bound
* @param inclusive <code>true</code> if the bound is inclusive
- * @param value the bound value
+ * @param values the bound value
* @return a new <code>SingleColumnRestriction.Slice</code> instance for the specified clustering column
*/
- private static Restriction newMultiSlice(CFMetaData cfMetaData, int firstIndex, Bound bound, boolean inclusive, ByteBuffer... values)
+ private static Restriction newMultiSlice(TableMetadata tableMetadata, int firstIndex, Bound bound, boolean inclusive, ByteBuffer... values)
{
- List<ColumnDefinition> columnDefinitions = new ArrayList<>();
+ List<ColumnMetadata> columnMetadatas = new ArrayList<>();
for (int i = 0; i < values.length; i++)
{
- columnDefinitions.add(getClusteringColumnDefinition(cfMetaData, i + firstIndex));
+ columnMetadatas.add(getClusteringColumnDefinition(tableMetadata, i + firstIndex));
}
- return new MultiColumnRestriction.SliceRestriction(columnDefinitions, bound, inclusive, toMultiItemTerminal(values));
+ return new MultiColumnRestriction.SliceRestriction(columnMetadatas, bound, inclusive, toMultiItemTerminal(values));
}
/**