adelapena commented on a change in pull request #891:
URL: https://github.com/apache/cassandra/pull/891#discussion_r581156751
##########
File path: test/unit/org/apache/cassandra/db/filter/ColumnFilterTest.java
##########
@@ -36,143 +48,388 @@
import static org.junit.Assert.assertEquals;
+@RunWith(Parameterized.class)
public class ColumnFilterTest
{
private static final ColumnFilter.Serializer serializer = new
ColumnFilter.Serializer();
+ private final CFMetaData metadata = CFMetaData.Builder.create("ks",
"table")
+
.withPartitioner(Murmur3Partitioner.instance)
+
.addPartitionKey("pk", Int32Type.instance)
+
.addClusteringColumn("ck", Int32Type.instance)
+
.addStaticColumn("s1", Int32Type.instance)
+
.addStaticColumn("s2", SetType.getInstance(Int32Type.instance, true))
+
.addRegularColumn("v1", Int32Type.instance)
+
.addRegularColumn("v2", SetType.getInstance(Int32Type.instance, true))
+ .build();
+
+ private final ColumnDefinition s1 =
metadata.getColumnDefinition(ByteBufferUtil.bytes("s1"));
+ private final ColumnDefinition s2 =
metadata.getColumnDefinition(ByteBufferUtil.bytes("s2"));
+ private final ColumnDefinition v1 =
metadata.getColumnDefinition(ByteBufferUtil.bytes("v1"));
+ private final ColumnDefinition v2 =
metadata.getColumnDefinition(ByteBufferUtil.bytes("v2"));
+ private final CellPath path0 = CellPath.create(ByteBufferUtil.bytes(0));
+ private final CellPath path1 = CellPath.create(ByteBufferUtil.bytes(1));
+ private final CellPath path2 = CellPath.create(ByteBufferUtil.bytes(2));
+ private final CellPath path3 = CellPath.create(ByteBufferUtil.bytes(3));
+ private final CellPath path4 = CellPath.create(ByteBufferUtil.bytes(4));
+
+ @Parameterized.Parameter(0)
+ public boolean anyNodeOn30;
+
+ @Parameterized.Parameters(name = "{index}: anyNodeOn30={0}")
+ public static Collection<Object[]> data()
+ {
+ return Arrays.asList(new Object[]{ true }, new Object[]{ false });
+ }
+
+ @BeforeClass
+ public static void beforeClass()
+ {
+ DatabaseDescriptor.clientInitialization();
+ }
+
+ @Before
+ public void before()
+ {
+ Gossiper.instance.setAnyNodeOn30(anyNodeOn30);
+ }
+
+ // Select all
+
@Test
- public void columnFilterSerialisationRoundTrip() throws Exception
- {
- CFMetaData metadata = CFMetaData.Builder.create("ks", "table")
-
.withPartitioner(Murmur3Partitioner.instance)
- .addPartitionKey("pk",
Int32Type.instance)
- .addClusteringColumn("ck",
Int32Type.instance)
- .addRegularColumn("v1",
Int32Type.instance)
- .addRegularColumn("v2",
Int32Type.instance)
- .addRegularColumn("v3",
Int32Type.instance)
- .build();
-
- ColumnDefinition v1 =
metadata.getColumnDefinition(ByteBufferUtil.bytes("v1"));
-
- testRoundTrip(ColumnFilter.all(metadata), metadata,
MessagingService.VERSION_30);
- testRoundTrip(ColumnFilter.all(metadata), metadata,
MessagingService.VERSION_3014);
-
-
testRoundTrip(ColumnFilter.selection(metadata.partitionColumns().without(v1)),
metadata, MessagingService.VERSION_30);
-
testRoundTrip(ColumnFilter.selection(metadata.partitionColumns().without(v1)),
metadata, MessagingService.VERSION_3014);
- }
-
- private static void testRoundTrip(ColumnFilter columnFilter, CFMetaData
metadata, int version) throws Exception
- {
- DataOutputBuffer output = new DataOutputBuffer();
- serializer.serialize(columnFilter, output, version);
- Assert.assertEquals(serializer.serializedSize(columnFilter, version),
output.position());
- DataInputPlus input = new DataInputBuffer(output.buffer(), false);
- Assert.assertEquals(serializer.deserialize(input, version, metadata),
columnFilter);
- }
-
- /**
- * Tests whether a filter fetches and/or queries columns and cells.
- */
- @Test
- public void testFetchedQueried()
- {
- CFMetaData metadata = CFMetaData.Builder.create("ks", "table")
-
.withPartitioner(Murmur3Partitioner.instance)
- .addPartitionKey("k",
Int32Type.instance)
- .addRegularColumn("simple",
Int32Type.instance)
- .addRegularColumn("complex",
SetType.getInstance(Int32Type.instance, true))
- .build();
-
- ColumnDefinition simple =
metadata.getColumnDefinition(ByteBufferUtil.bytes("simple"));
- ColumnDefinition complex =
metadata.getColumnDefinition(ByteBufferUtil.bytes("complex"));
- CellPath path1 = CellPath.create(ByteBufferUtil.bytes(1));
- CellPath path2 = CellPath.create(ByteBufferUtil.bytes(2));
- ColumnFilter filter;
-
- // select only the simple column, without table metadata
- filter =
ColumnFilter.selection(PartitionColumns.builder().add(simple).build());
- assertFetchedQueried(true, true, filter, simple);
- assertFetchedQueried(false, false, filter, complex);
- assertFetchedQueried(false, false, filter, complex, path1);
- assertFetchedQueried(false, false, filter, complex, path2);
-
- // select only the complex column, without table metadata
- filter =
ColumnFilter.selection(PartitionColumns.builder().add(complex).build());
- assertFetchedQueried(false, false, filter, simple);
- assertFetchedQueried(true, true, filter, complex);
- assertFetchedQueried(true, true, filter, complex, path1);
- assertFetchedQueried(true, true, filter, complex, path2);
-
- // select both the simple and complex columns, without table metadata
- filter =
ColumnFilter.selection(PartitionColumns.builder().add(simple).add(complex).build());
- assertFetchedQueried(true, true, filter, simple);
- assertFetchedQueried(true, true, filter, complex);
- assertFetchedQueried(true, true, filter, complex, path1);
- assertFetchedQueried(true, true, filter, complex, path2);
-
- // select only the simple column, with table metadata
- filter = ColumnFilter.selection(metadata,
PartitionColumns.builder().add(simple).build());
- assertFetchedQueried(true, true, filter, simple);
- assertFetchedQueried(true, false, filter, complex);
- assertFetchedQueried(true, false, filter, complex, path1);
- assertFetchedQueried(true, false, filter, complex, path2);
-
- // select only the complex column, with table metadata
- filter = ColumnFilter.selection(metadata,
PartitionColumns.builder().add(complex).build());
- assertFetchedQueried(true, false, filter, simple);
- assertFetchedQueried(true, true, filter, complex);
- assertFetchedQueried(true, true, filter, complex, path1);
- assertFetchedQueried(true, true, filter, complex, path2);
-
- // select both the simple and complex columns, with table metadata
- filter = ColumnFilter.selection(metadata,
PartitionColumns.builder().add(simple).add(complex).build());
- assertFetchedQueried(true, true, filter, simple);
- assertFetchedQueried(true, true, filter, complex);
- assertFetchedQueried(true, true, filter, complex, path1);
- assertFetchedQueried(true, true, filter, complex, path2);
-
- // select only the simple column, with selection builder
- filter = ColumnFilter.selectionBuilder().add(simple).build();
- assertFetchedQueried(true, true, filter, simple);
- assertFetchedQueried(false, false, filter, complex);
- assertFetchedQueried(false, false, filter, complex, path1);
- assertFetchedQueried(false, false, filter, complex, path2);
-
- // select only a cell of the complex column, with selection builder
- filter = ColumnFilter.selectionBuilder().select(complex,
path1).build();
- assertFetchedQueried(false, false, filter, simple);
- assertFetchedQueried(true, true, filter, complex);
- assertFetchedQueried(true, true, filter, complex, path1);
- assertFetchedQueried(true, false, filter, complex, path2);
-
- // select both the simple column and a cell of the complex column,
with selection builder
- filter = ColumnFilter.selectionBuilder().add(simple).select(complex,
path1).build();
- assertFetchedQueried(true, true, filter, simple);
- assertFetchedQueried(true, true, filter, complex);
- assertFetchedQueried(true, true, filter, complex, path1);
- assertFetchedQueried(true, false, filter, complex, path2);
+ public void testSelectAll() throws Exception
Review comment:
As mentioned in the PR for 3.0, we don't need the `throws Exception`
anymore
##########
File path: test/unit/org/apache/cassandra/db/filter/ColumnFilterTest.java
##########
@@ -36,143 +48,388 @@
import static org.junit.Assert.assertEquals;
+@RunWith(Parameterized.class)
public class ColumnFilterTest
{
private static final ColumnFilter.Serializer serializer = new
ColumnFilter.Serializer();
+ private final CFMetaData metadata = CFMetaData.Builder.create("ks",
"table")
+
.withPartitioner(Murmur3Partitioner.instance)
+
.addPartitionKey("pk", Int32Type.instance)
+
.addClusteringColumn("ck", Int32Type.instance)
+
.addStaticColumn("s1", Int32Type.instance)
+
.addStaticColumn("s2", SetType.getInstance(Int32Type.instance, true))
+
.addRegularColumn("v1", Int32Type.instance)
+
.addRegularColumn("v2", SetType.getInstance(Int32Type.instance, true))
+ .build();
+
+ private final ColumnDefinition s1 =
metadata.getColumnDefinition(ByteBufferUtil.bytes("s1"));
+ private final ColumnDefinition s2 =
metadata.getColumnDefinition(ByteBufferUtil.bytes("s2"));
+ private final ColumnDefinition v1 =
metadata.getColumnDefinition(ByteBufferUtil.bytes("v1"));
+ private final ColumnDefinition v2 =
metadata.getColumnDefinition(ByteBufferUtil.bytes("v2"));
+ private final CellPath path0 = CellPath.create(ByteBufferUtil.bytes(0));
+ private final CellPath path1 = CellPath.create(ByteBufferUtil.bytes(1));
+ private final CellPath path2 = CellPath.create(ByteBufferUtil.bytes(2));
+ private final CellPath path3 = CellPath.create(ByteBufferUtil.bytes(3));
+ private final CellPath path4 = CellPath.create(ByteBufferUtil.bytes(4));
+
+ @Parameterized.Parameter(0)
+ public boolean anyNodeOn30;
+
+ @Parameterized.Parameters(name = "{index}: anyNodeOn30={0}")
+ public static Collection<Object[]> data()
+ {
+ return Arrays.asList(new Object[]{ true }, new Object[]{ false });
+ }
+
+ @BeforeClass
+ public static void beforeClass()
+ {
+ DatabaseDescriptor.clientInitialization();
+ }
+
+ @Before
+ public void before()
+ {
+ Gossiper.instance.setAnyNodeOn30(anyNodeOn30);
+ }
+
+ // Select all
+
@Test
- public void columnFilterSerialisationRoundTrip() throws Exception
- {
- CFMetaData metadata = CFMetaData.Builder.create("ks", "table")
-
.withPartitioner(Murmur3Partitioner.instance)
- .addPartitionKey("pk",
Int32Type.instance)
- .addClusteringColumn("ck",
Int32Type.instance)
- .addRegularColumn("v1",
Int32Type.instance)
- .addRegularColumn("v2",
Int32Type.instance)
- .addRegularColumn("v3",
Int32Type.instance)
- .build();
-
- ColumnDefinition v1 =
metadata.getColumnDefinition(ByteBufferUtil.bytes("v1"));
-
- testRoundTrip(ColumnFilter.all(metadata), metadata,
MessagingService.VERSION_30);
- testRoundTrip(ColumnFilter.all(metadata), metadata,
MessagingService.VERSION_3014);
-
-
testRoundTrip(ColumnFilter.selection(metadata.partitionColumns().without(v1)),
metadata, MessagingService.VERSION_30);
-
testRoundTrip(ColumnFilter.selection(metadata.partitionColumns().without(v1)),
metadata, MessagingService.VERSION_3014);
- }
-
- private static void testRoundTrip(ColumnFilter columnFilter, CFMetaData
metadata, int version) throws Exception
- {
- DataOutputBuffer output = new DataOutputBuffer();
- serializer.serialize(columnFilter, output, version);
- Assert.assertEquals(serializer.serializedSize(columnFilter, version),
output.position());
- DataInputPlus input = new DataInputBuffer(output.buffer(), false);
- Assert.assertEquals(serializer.deserialize(input, version, metadata),
columnFilter);
- }
-
- /**
- * Tests whether a filter fetches and/or queries columns and cells.
- */
- @Test
- public void testFetchedQueried()
- {
- CFMetaData metadata = CFMetaData.Builder.create("ks", "table")
-
.withPartitioner(Murmur3Partitioner.instance)
- .addPartitionKey("k",
Int32Type.instance)
- .addRegularColumn("simple",
Int32Type.instance)
- .addRegularColumn("complex",
SetType.getInstance(Int32Type.instance, true))
- .build();
-
- ColumnDefinition simple =
metadata.getColumnDefinition(ByteBufferUtil.bytes("simple"));
- ColumnDefinition complex =
metadata.getColumnDefinition(ByteBufferUtil.bytes("complex"));
- CellPath path1 = CellPath.create(ByteBufferUtil.bytes(1));
- CellPath path2 = CellPath.create(ByteBufferUtil.bytes(2));
- ColumnFilter filter;
-
- // select only the simple column, without table metadata
- filter =
ColumnFilter.selection(PartitionColumns.builder().add(simple).build());
- assertFetchedQueried(true, true, filter, simple);
- assertFetchedQueried(false, false, filter, complex);
- assertFetchedQueried(false, false, filter, complex, path1);
- assertFetchedQueried(false, false, filter, complex, path2);
-
- // select only the complex column, without table metadata
- filter =
ColumnFilter.selection(PartitionColumns.builder().add(complex).build());
- assertFetchedQueried(false, false, filter, simple);
- assertFetchedQueried(true, true, filter, complex);
- assertFetchedQueried(true, true, filter, complex, path1);
- assertFetchedQueried(true, true, filter, complex, path2);
-
- // select both the simple and complex columns, without table metadata
- filter =
ColumnFilter.selection(PartitionColumns.builder().add(simple).add(complex).build());
- assertFetchedQueried(true, true, filter, simple);
- assertFetchedQueried(true, true, filter, complex);
- assertFetchedQueried(true, true, filter, complex, path1);
- assertFetchedQueried(true, true, filter, complex, path2);
-
- // select only the simple column, with table metadata
- filter = ColumnFilter.selection(metadata,
PartitionColumns.builder().add(simple).build());
- assertFetchedQueried(true, true, filter, simple);
- assertFetchedQueried(true, false, filter, complex);
- assertFetchedQueried(true, false, filter, complex, path1);
- assertFetchedQueried(true, false, filter, complex, path2);
-
- // select only the complex column, with table metadata
- filter = ColumnFilter.selection(metadata,
PartitionColumns.builder().add(complex).build());
- assertFetchedQueried(true, false, filter, simple);
- assertFetchedQueried(true, true, filter, complex);
- assertFetchedQueried(true, true, filter, complex, path1);
- assertFetchedQueried(true, true, filter, complex, path2);
-
- // select both the simple and complex columns, with table metadata
- filter = ColumnFilter.selection(metadata,
PartitionColumns.builder().add(simple).add(complex).build());
- assertFetchedQueried(true, true, filter, simple);
- assertFetchedQueried(true, true, filter, complex);
- assertFetchedQueried(true, true, filter, complex, path1);
- assertFetchedQueried(true, true, filter, complex, path2);
-
- // select only the simple column, with selection builder
- filter = ColumnFilter.selectionBuilder().add(simple).build();
- assertFetchedQueried(true, true, filter, simple);
- assertFetchedQueried(false, false, filter, complex);
- assertFetchedQueried(false, false, filter, complex, path1);
- assertFetchedQueried(false, false, filter, complex, path2);
-
- // select only a cell of the complex column, with selection builder
- filter = ColumnFilter.selectionBuilder().select(complex,
path1).build();
- assertFetchedQueried(false, false, filter, simple);
- assertFetchedQueried(true, true, filter, complex);
- assertFetchedQueried(true, true, filter, complex, path1);
- assertFetchedQueried(true, false, filter, complex, path2);
-
- // select both the simple column and a cell of the complex column,
with selection builder
- filter = ColumnFilter.selectionBuilder().add(simple).select(complex,
path1).build();
- assertFetchedQueried(true, true, filter, simple);
- assertFetchedQueried(true, true, filter, complex);
- assertFetchedQueried(true, true, filter, complex, path1);
- assertFetchedQueried(true, false, filter, complex, path2);
+ public void testSelectAll() throws Exception
+ {
+ Consumer<ColumnFilter> check = filter -> {
+ testRoundTrips(filter);
+ assertEquals("*/*", filter.toString());
+ assertFetchedQueried(true, true, filter, v1, v2, s1, s2);
+ assertCellFetchedQueried(true, true, filter, v2, path0, path1,
path2, path3, path4);
+ assertCellFetchedQueried(true, true, filter, s2, path0, path1,
path2, path3, path4);
+ };
+
+ check.accept(ColumnFilter.all(metadata));
+ check.accept(ColumnFilter.allColumnsBuilder(metadata).build());
}
- private static void assertFetchedQueried(boolean expectedFetched,
- boolean expectedQueried,
- ColumnFilter filter,
- ColumnDefinition column)
+ // Selections
+
+ @Test
+ public void testSelectNothing() throws Exception
{
- assert !expectedQueried || expectedFetched;
- boolean actualFetched = filter.fetches(column);
- assertEquals(expectedFetched, actualFetched);
- assertEquals(expectedQueried, actualFetched &&
filter.fetchedColumnIsQueried(column));
+ Consumer<ColumnFilter> check = filter -> {
+ testRoundTrips(filter);
+ assertEquals("[]", filter.toString());
+ assertFetchedQueried(false, false, filter, v1, v2, s1, s2);
+ assertCellFetchedQueried(false, false, filter, v2, path0, path1,
path2, path3, path4);
+ assertCellFetchedQueried(false, false, filter, s2, path0, path1,
path2, path3, path4);
+ };
+
+ check.accept(ColumnFilter.selection(PartitionColumns.NONE));
+ check.accept(ColumnFilter.selectionBuilder().build());
+ }
+
+ @Test
+ public void testSelectSimpleColumn() throws Exception
+ {
+ Consumer<ColumnFilter> check = filter -> {
+ testRoundTrips(filter);
+ assertEquals("[v1]", filter.toString());
+ assertFetchedQueried(true, true, filter, v1);
+ assertFetchedQueried(false, false, filter, v2, s1, s2);
+ assertCellFetchedQueried(false, false, filter, v2, path0, path1,
path2, path3, path4);
+ assertCellFetchedQueried(false, false, filter, s2, path0, path1,
path2, path3, path4);
+ };
+
+
check.accept(ColumnFilter.selection(PartitionColumns.builder().add(v1).build()));
+ check.accept(ColumnFilter.selectionBuilder().add(v1).build());
+ }
+
+ @Test
+ public void testSelectComplexColumn() throws Exception
+ {
+ Consumer<ColumnFilter> check = filter -> {
+ testRoundTrips(filter);
+ assertEquals("[v2]", filter.toString());
+ assertFetchedQueried(true, true, filter, v2);
+ assertFetchedQueried(false, false, filter, v1, s1, s2);
+ assertCellFetchedQueried(true, true, filter, v2, path0, path1,
path2, path3, path4);
+ assertCellFetchedQueried(false, false, filter, s2, path0, path1,
path2, path3, path4);
+ };
+
+
check.accept(ColumnFilter.selection(PartitionColumns.builder().add(v2).build()));
+ check.accept(ColumnFilter.selectionBuilder().add(v2).build());
+ }
+
+ @Test
+ public void testSelectStaticColumn() throws Exception
+ {
+ Consumer<ColumnFilter> check = filter -> {
+ testRoundTrips(filter);
+ assertEquals("[s1]", filter.toString());
+ assertFetchedQueried(true, true, filter, s1);
+ assertFetchedQueried(false, false, filter, v1, v2, s2);
+ assertCellFetchedQueried(false, false, filter, v2, path0, path1,
path2, path3, path4);
+ assertCellFetchedQueried(false, false, filter, s2, path0, path1,
path2, path3, path4);
+ };
+
+
check.accept(ColumnFilter.selection(PartitionColumns.builder().add(s1).build()));
+ check.accept(ColumnFilter.selectionBuilder().add(s1).build());
+ }
+
+ @Test
+ public void testSelectStaticComplexColumn() throws Exception
+ {
+ Consumer<ColumnFilter> check = filter -> {
+ testRoundTrips(filter);
+ assertEquals("[s2]", filter.toString());
+ assertFetchedQueried(true, true, filter, s2);
+ assertFetchedQueried(false, false, filter, v1, v2, s1);
+ assertCellFetchedQueried(false, false, filter, v2, path0, path1,
path2, path3, path4);
+ assertCellFetchedQueried(true, true, filter, s2, path0, path1,
path2, path3, path4);
+ };
+
+
check.accept(ColumnFilter.selection(PartitionColumns.builder().add(s2).build()));
+ check.accept(ColumnFilter.selectionBuilder().add(s2).build());
+ }
+
+ @Test
+ public void testSelectColumns() throws Exception
+ {
+ Consumer<ColumnFilter> check = filter -> {
+ testRoundTrips(filter);
+ assertEquals("[s1, s2, v1, v2]", filter.toString());
+ assertFetchedQueried(true, true, filter, v1, v2, s1, s2);
+ assertCellFetchedQueried(true, true, filter, v2, path0, path1,
path2, path3, path4);
+ assertCellFetchedQueried(true, true, filter, s2, path0, path1,
path2, path3, path4);
+ };
+
+
check.accept(ColumnFilter.selection(PartitionColumns.builder().add(v1).add(v2).add(s1).add(s2).build()));
+
check.accept(ColumnFilter.selectionBuilder().add(v1).add(v2).add(s1).add(s2).build());
+ }
+
+ @Test
+ public void testSelectIndividualCells() throws Exception
+ {
+ ColumnFilter filter = ColumnFilter.selectionBuilder().select(v2,
path1).select(v2, path3).build();
+ testRoundTrips(filter);
+ assertEquals("[v2[1], v2[3]]", filter.toString());
+ assertFetchedQueried(true, true, filter, v2);
+ assertFetchedQueried(false, false, filter, v1, s1, s2);
+ assertCellFetchedQueried(true, true, filter, v2, path1, path3);
+ assertCellFetchedQueried(false, false, filter, v2, path0, path2,
path4);
+ assertCellFetchedQueried(false, false, filter, s2, path0, path1,
path2, path3, path4);
+ }
+
+ @Test
+ public void testSelectIndividualCellsFromStatic() throws Exception
+ {
+ ColumnFilter filter = ColumnFilter.selectionBuilder().select(s2,
path1).select(s2, path3).build();
+ testRoundTrips(filter);
+ assertEquals("[s2[1], s2[3]]", filter.toString());
+ assertFetchedQueried(true, true, filter, s2);
+ assertFetchedQueried(false, false, filter, v1, v2, s1);
+ assertCellFetchedQueried(false, false, filter, v2, path0, path1,
path2, path3, path4);
+ assertCellFetchedQueried(true, true, filter, s2, path1, path3);
+ assertCellFetchedQueried(false, false, filter, s2, path0, path2,
path4);
+ }
+
+ @Test
+ public void testSelectCellSlice() throws Exception
+ {
+ ColumnFilter filter = ColumnFilter.selectionBuilder().slice(v2, path1,
path3).build();
+ testRoundTrips(filter);
+ assertEquals("[v2[1:3]]", filter.toString());
+ assertFetchedQueried(true, true, filter, v2);
+ assertFetchedQueried(false, false, filter, v1, s1, s2);
+ assertCellFetchedQueried(true, true, filter, v2, path1, path2, path3);
+ assertCellFetchedQueried(false, false, filter, v2, path0, path4);
+ assertCellFetchedQueried(false, false, filter, s2, path0, path1,
path2, path3, path4);
+ }
+
+ @Test
+ public void testSelectCellSliceFromStatic() throws Exception
+ {
+ ColumnFilter filter = ColumnFilter.selectionBuilder().slice(s2, path1,
path3).build();
+ testRoundTrips(filter);
+ assertEquals("[s2[1:3]]", filter.toString());
+ assertFetchedQueried(true, true, filter, s2);
+ assertFetchedQueried(false, false, filter, v1, v2, s1);
+ assertCellFetchedQueried(false, false, filter, v2, path0, path1,
path2, path3, path4);
+ assertCellFetchedQueried(true, true, filter, s2, path1, path2, path3);
+ assertCellFetchedQueried(false, false, filter, s2, path0, path4);
+ }
+
+ @Test
+ public void testSelectColumnsWithCellsAndSlices() throws Exception
+ {
+ ColumnFilter filter =
ColumnFilter.selectionBuilder().add(v1).add(s1).slice(v2, path0,
path2).select(v2, path4).select(s2, path0).slice(s2, path2, path4).build();
+ testRoundTrips(filter);
+ assertEquals("[s1, s2[0], s2[2:4], v1, v2[0:2], v2[4]]",
filter.toString());
+ assertFetchedQueried(true, true, filter, v1, v2, s1, s2);
+ assertCellFetchedQueried(true, true, filter, v2, path0, path1, path2,
path4);
+ assertCellFetchedQueried(false, false, filter, v2, path3);
+ assertCellFetchedQueried(true, true, filter, s2, path0, path2, path3,
path4);
+ assertCellFetchedQueried(false, false, filter, s2, path1);
+ }
+
+ // select with metadata
+
+ @Test
+ public void testSelectSimpleColumnWithMetadata() throws Exception
+ {
+ Consumer<ColumnFilter> check = filter -> {
+ testRoundTrips(filter);
+ assertFetchedQueried(true, true, filter, v1);
+ if (anyNodeOn30)
+ {
+ assertEquals("*/*", filter.toString());
+ assertFetchedQueried(true, true, filter, s1, s2, v2);
+ assertCellFetchedQueried(true, true, filter, v2, path0, path1,
path2, path3, path4);
+ assertCellFetchedQueried(true, true, filter, s2, path0, path1,
path2, path3, path4);
+ }
+ else
+ {
+ assertEquals("*/[v1]", filter.toString());
+ assertFetchedQueried(true, false, filter, s1, s2, v2);
+ assertCellFetchedQueried(true, false, filter, v2, path0,
path1, path2, path3, path4);
+ assertCellFetchedQueried(true, false, filter, s2, path0,
path1, path2, path3, path4);
+ }
Review comment:
Nit: maybe it would be a bit easier to spot the differences between
mixed and normal modes this way:
```suggestion
assertEquals(anyNodeOn30 ? "*/*" : "*/[v1]", filter.toString());
assertFetchedQueried(true, anyNodeOn30, filter, s1, s2, v2);
assertCellFetchedQueried(true, anyNodeOn30, filter, v2, path0,
path1, path2, path3, path4);
assertCellFetchedQueried(true, anyNodeOn30, filter, s2, path0,
path1, path2, path3, path4);
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]