This is an automated email from the ASF dual-hosted git repository. adelapena pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra.git
commit 0e990d7231f6152e95d5c21a6660594fc9a507bb Merge: b70ae0e dc82d48 Author: Andrés de la Peña <[email protected]> AuthorDate: Wed Mar 10 17:34:20 2021 +0000 Merge branch 'cassandra-3.11' into trunk CHANGES.txt | 1 + .../org/apache/cassandra/db/AbstractReadQuery.java | 2 +- src/java/org/apache/cassandra/db/ReadCommand.java | 2 +- .../apache/cassandra/db/filter/ColumnFilter.java | 38 ++++++++++++------- .../cassandra/db/filter/ColumnFilterTest.java | 44 ++++++++++++++++++++++ 5 files changed, 72 insertions(+), 15 deletions(-) diff --cc CHANGES.txt index a3a03c0,b959a43..ffec3cb --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,49 -1,9 +1,50 @@@ -3.11.11 +4.0-beta5 + * Send FAILED_SESSION_MSG on shutdown and on in-progress repairs during startup (CASSANDRA-16425) + * Reinstate removed ApplicationState padding (CASSANDRA-16484) + * Expose data dirs to ColumnFamilyStoreMBean (CASSANDRA-16335) + * Add possibility to copy SSTables in SSTableImporter instead of moving them (CASSANDRA-16407) + * Fix DESCRIBE statement for CUSTOM indices with options (CASSANDRA-16482) + * Fix cassandra-stress JMX connection (CASSANDRA-16473) + * Avoid processing redundant application states on endpoint changes (CASSANDRA-16381) + * Prevent parent repair sessions leak (CASSANDRA-16446) + * Fix timestamp issue in SinglePartitionSliceCommandTest testPartitionD…eletionRowDeletionTie (CASSANDRA-16443) + * Promote protocol V5 out of beta (CASSANDRA-14973) + * Fix incorrect encoding for strings can be UTF8 (CASSANDRA-16429) + * Fix node unable to join when RF > N in multi-DC with added warning (CASSANDRA-16296) + * Add an option to nodetool tablestats to check sstable location correctness (CASSANDRA-16344) + * Unable to ALTER KEYSPACE while decommissioned/assassinated nodes are in gossip (CASSANDRA-16422) + * Metrics backward compatibility restored after CASSANDRA-15066 (CASSANDRA-16083) + * Reduce new reserved keywords introduced since 3.0 (CASSANDRA-16439) + * Improve system tables handling in case of disk failures (CASSANDRA-14793) + * Add access and datacenters to unreserved keywords (CASSANDRA-16398) + * Fix nodetool ring, status output when DNS resolution or port printing are in use (CASSANDRA-16283) + * Upgrade Jacoco to 0.8.6 (for Java 11 support) (CASSANDRA-16365) + * Move excessive repair debug loggings to trace level (CASSANDRA-16406) + * Restore validation of each message's protocol version (CASSANDRA-16374) + * Upgrade netty and chronicle-queue dependencies to get Auditing and native library loading working on arm64 architectures (CASSANDRA-16384,CASSANDRA-16392) + * Release StreamingTombstoneHistogramBuilder spool when switching writers (CASSANDRA-14834) + * Correct memtable on-heap size calculations to match actual use (CASSANDRA-16318) + * Fix client notifications in CQL protocol v5 (CASSANDRA-16353) + * Too defensive check when picking sstables for preview repair (CASSANDRA-16284) + * Ensure pre-negotiation native protocol responses have correct stream id (CASSANDRA-16376) + * Fix check for -Xlog in cassandra-env.sh (CASSANDRA-16279) + * SSLFactory should initialize SSLContext before setting protocols (CASSANDRA-16362) + * Restore sasi dependencies jflex, snowball-stemmer, and concurrent-trees, in the cassandra-all pom (CASSANDRA-16303) + * Fix DecimalDeserializer#toString OOM (CASSANDRA-14925) +Merged from 3.11: * Upgrade jackson-databind to 2.9.10.8 (CASSANDRA-16462) + * Fix digest computation for queries with fetched but non queried columns (CASSANDRA-15962) + * Reduce amount of allocations during batch statement execution (CASSANDRA-16201) + * Update jflex-1.6.0.jar to match upstream (CASSANDRA-16393) Merged from 3.0: + * Fix ColumnFilter::toString not returning a valid CQL fragment (CASSANDRA-16483) * Fix ColumnFilter behaviour to prevent digest mitmatches during upgrades (CASSANDRA-16415) + * Update debian packaging for python3 (CASSANDRA-16396) * Avoid pushing schema mutations when setting up distributed system keyspaces locally (CASSANDRA-16387) + * Prevent unbounded number of pending flushing tasks (CASSANDRA-16261) + * Improve empty hint file handling during startup (CASSANDRA-16162) + * Fix skipping on pre-3.0 created compact storage sstables due to missing primary key liveness (CASSANDRA-16226) + * Allow empty string in collections with COPY FROM in cqlsh (CASSANDRA-16372) Merged from 2.2: * Fix centos packaging for arm64, >=4.0 rpm's now require python3 (CASSANDRA-16477) * Make TokenMetadata's ring version increments atomic (CASSANDRA-16286) diff --cc src/java/org/apache/cassandra/db/AbstractReadQuery.java index c6ec329,0000000..ec1a6b1 mode 100644,000000..100644 --- a/src/java/org/apache/cassandra/db/AbstractReadQuery.java +++ b/src/java/org/apache/cassandra/db/AbstractReadQuery.java @@@ -1,116 -1,0 +1,116 @@@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cassandra.db; + +import org.apache.cassandra.db.filter.ColumnFilter; +import org.apache.cassandra.db.filter.DataLimits; +import org.apache.cassandra.db.filter.RowFilter; +import org.apache.cassandra.db.monitoring.MonitorableImpl; +import org.apache.cassandra.db.partitions.PartitionIterator; +import org.apache.cassandra.db.partitions.UnfilteredPartitionIterators; +import org.apache.cassandra.schema.TableMetadata; + +/** + * Base class for {@code ReadQuery} implementations. + */ +abstract class AbstractReadQuery extends MonitorableImpl implements ReadQuery +{ + private final TableMetadata metadata; + private final int nowInSec; + + private final ColumnFilter columnFilter; + private final RowFilter rowFilter; + private final DataLimits limits; + + protected AbstractReadQuery(TableMetadata metadata, int nowInSec, ColumnFilter columnFilter, RowFilter rowFilter, DataLimits limits) + { + this.metadata = metadata; + this.nowInSec = nowInSec; + this.columnFilter = columnFilter; + this.rowFilter = rowFilter; + this.limits = limits; + } + + @Override + public TableMetadata metadata() + { + return metadata; + } + + // Monitorable interface + public String name() + { + return toCQLString(); + } + + @Override + public PartitionIterator executeInternal(ReadExecutionController controller) + { + return UnfilteredPartitionIterators.filter(executeLocally(controller), nowInSec()); + } + + @Override + public DataLimits limits() + { + return limits; + } + + @Override + public int nowInSec() + { + return nowInSec; + } + + @Override + public RowFilter rowFilter() + { + return rowFilter; + } + + @Override + public ColumnFilter columnFilter() + { + return columnFilter; + } + + /** + * Recreate the CQL string corresponding to this query. + * <p> + * Note that in general the returned string will not be exactly the original user string, first + * because there isn't always a single syntax for a given query, but also because we don't have + * all the information needed (we know the non-PK columns queried but not the PK ones as internally + * we query them all). So this shouldn't be relied too strongly, but this should be good enough for + * debugging purpose which is what this is for. + */ + public String toCQLString() + { + StringBuilder sb = new StringBuilder().append("SELECT ") - .append(columnFilter()) ++ .append(columnFilter().toCQLString()) + .append(" FROM ") + .append(metadata().keyspace) + .append('.') + .append(metadata().name); + appendCQLWhereClause(sb); + + if (limits() != DataLimits.NONE) + sb.append(' ').append(limits()); + return sb.toString(); + } + + protected abstract void appendCQLWhereClause(StringBuilder sb); +} diff --cc src/java/org/apache/cassandra/db/ReadCommand.java index 844a7b5,548b0c7..7b889d1 --- a/src/java/org/apache/cassandra/db/ReadCommand.java +++ b/src/java/org/apache/cassandra/db/ReadCommand.java @@@ -728,8 -686,8 +728,8 @@@ public abstract class ReadCommand exten public String toCQLString() { StringBuilder sb = new StringBuilder(); - sb.append("SELECT ").append(columnFilter()); + sb.append("SELECT ").append(columnFilter().toCQLString()); - sb.append(" FROM ").append(metadata().ksName).append('.').append(metadata().cfName); + sb.append(" FROM ").append(metadata().keyspace).append('.').append(metadata().name); appendCQLWhereClause(sb); if (limits() != DataLimits.NONE) diff --cc src/java/org/apache/cassandra/db/filter/ColumnFilter.java index 8ca2ccc,dfbce4a..832e3a6 --- a/src/java/org/apache/cassandra/db/filter/ColumnFilter.java +++ b/src/java/org/apache/cassandra/db/filter/ColumnFilter.java @@@ -510,27 -369,19 +510,27 @@@ public class ColumnFilte SortedSetMultimap<ColumnIdentifier, ColumnSubselection> s = null; if (subSelections != null) { - s = TreeMultimap.create(Comparator.<ColumnIdentifier>naturalOrder(), Comparator.<ColumnSubselection>naturalOrder()); + s = TreeMultimap.create(Comparator.naturalOrder(), Comparator.naturalOrder()); for (ColumnSubselection subSelection : subSelections) - s.put(subSelection.column().name, subSelection); - } - - // See the comment in {@link ColumnFilter#selection(CFMetaData, PartitionColumns)} - if (isFetchAll && queried != null && Gossiper.instance.isAnyNodeOn30()) - { - logger.trace("Column filter will be automatically converted to query all columns because 3.0 nodes are present in the cluster"); - queried = null; + { + if (fullySelectedComplexColumns == null || !fullySelectedComplexColumns.contains(subSelection.column())) + s.put(subSelection.column().name, subSelection); + } } - return new ColumnFilter(isFetchAll, isFetchAll ? metadata.partitionColumns() : null, queried, s); + // When fetchAll is enabled on pre CASSANDRA-10657 (3.4-), queried columns are not considered at all, and it + // is assumed that all columns are queried. CASSANDRA-10657 (3.4+) brings back skipping values of columns + // which are not in queried set when fetchAll is enabled. That makes exactly the same filter being + // interpreted in a different way on 3.4- and 3.4+. + // + // Moreover, there is no way to convert the filter with fetchAll and queried != null so that it is + // interpreted the same way on 3.4- because that Cassandra version does not support such filtering. + // + // In order to avoid inconsitencies in data read by 3.4- and 3.4+ we need to avoid creation of incompatible + // filters when the cluster contains 3.4- nodes. We do that by forcibly setting queried to null. + // + // see CASSANDRA-10657, CASSANDRA-15833, CASSANDRA-16415 + return new ColumnFilter(isFetchAll, isFetchAll && shouldFetchAllStatics(), metadata, isFetchAll && shouldQueriedBeNull() ? null : queried, s); } } @@@ -555,37 -405,45 +555,49 @@@ @Override public String toString() { - if (isFetchAll && queried == null) + String prefix = ""; + + if (fetchAllRegulars && queried == null) return "*/*"; - String prefix = ""; - if (isFetchAll) + if (fetchAllRegulars && fetchAllStatics) prefix = "*/"; - if (queried.isEmpty()) - return prefix + "[]"; + if (fetchAllRegulars && !fetchAllStatics) + { + prefix = queried.statics.isEmpty() - ? "<all regulars>/" - : String.format("<all regulars>+%s/", columnsToString(queried.statics::selectOrderIterator)); ++ ? "<all regulars>/" ++ : String.format("<all regulars>+%s/", toString(queried.statics.selectOrderIterator(), false)); + } - return prefix + columnsToString(queried::selectOrderIterator); - return prefix + toString(false); ++ return prefix + toString(queried.selectOrderIterator(), false); } - private String columnsToString(Iterable<ColumnMetadata> columns) + public String toCQLString() { - StringJoiner joiner = new StringJoiner(", ", "[", "]"); - Iterator<ColumnMetadata> it = columns.iterator(); - while (it.hasNext()) + if (queried == null || queried.isEmpty()) + return "*"; + - return toString(true); ++ return toString(queried.selectOrderIterator(), true); + } + - private String toString(boolean cql) ++ private String toString(Iterator<ColumnMetadata> columns, boolean cql) + { - Iterator<ColumnDefinition> columns = queried.selectOrderIterator(); + StringJoiner joiner = cql ? new StringJoiner(", ") : new StringJoiner(", ", "[", "]"); + + while (columns.hasNext()) { - ColumnMetadata column = it.next(); - SortedSet<ColumnSubselection> s = subSelections != null ? subSelections.get(column.name) : Collections.emptySortedSet(); - ColumnDefinition column = columns.next(); ++ ColumnMetadata column = columns.next(); + String columnName = cql ? column.name.toCQLString() : String.valueOf(column.name); + + SortedSet<ColumnSubselection> s = subSelections != null + ? subSelections.get(column.name) + : Collections.emptySortedSet(); if (s.isEmpty()) - joiner.add(String.valueOf(column.name)); + joiner.add(columnName); else - s.forEach(subSel -> joiner.add(String.format("%s%s", column.name, subSel))); + s.forEach(subSel -> joiner.add(String.format("%s%s", columnName, subSel))); } return joiner.toString(); } @@@ -661,8 -519,8 +673,8 @@@ SortedSetMultimap<ColumnIdentifier, ColumnSubselection> subSelections = null; if (hasSubSelections) { - subSelections = TreeMultimap.create(Comparator.<ColumnIdentifier>naturalOrder(), Comparator.<ColumnSubselection>naturalOrder()); + subSelections = TreeMultimap.create(Comparator.naturalOrder(), Comparator.naturalOrder()); - int size = (int)in.readUnsignedVInt(); + int size = (int) in.readUnsignedVInt(); for (int i = 0; i < size; i++) { ColumnSubselection subSel = ColumnSubselection.serializer.deserialize(in, version, metadata); diff --cc test/unit/org/apache/cassandra/db/filter/ColumnFilterTest.java index a96aa57,adf074f..194a92f --- a/test/unit/org/apache/cassandra/db/filter/ColumnFilterTest.java +++ b/test/unit/org/apache/cassandra/db/filter/ColumnFilterTest.java @@@ -30,8 -31,11 +30,9 @@@ import org.junit.Test import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import org.apache.cassandra.config.CFMetaData; -import org.apache.cassandra.config.ColumnDefinition; -import org.apache.cassandra.config.DatabaseDescriptor; +import org.apache.cassandra.Util; + import org.apache.cassandra.cql3.ColumnIdentifier; -import org.apache.cassandra.db.PartitionColumns; +import org.apache.cassandra.db.RegularAndStaticColumns; import org.apache.cassandra.db.marshal.Int32Type; import org.apache.cassandra.db.marshal.SetType; import org.apache.cassandra.db.rows.CellPath; @@@ -53,23 -54,22 +54,25 @@@ public class ColumnFilterTes { 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)) - .addRegularColumn(ColumnIdentifier.getInterned("Escaped Name", true), Int32Type.instance) - .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 ColumnDefinition escaped = metadata.getColumnDefinition(ByteBufferUtil.bytes("Escaped Name")); + @Parameterized.Parameter + public String clusterMinVersion; + + private final TableMetadata metadata = TableMetadata.builder("ks", "table") + .partitioner(Murmur3Partitioner.instance) + .addPartitionKeyColumn("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)) ++ .addRegularColumn(ColumnIdentifier.getInterned("Escaped Name", true), Int32Type.instance) + .build(); + + private final ColumnMetadata s1 = metadata.getColumn(ByteBufferUtil.bytes("s1")); + private final ColumnMetadata s2 = metadata.getColumn(ByteBufferUtil.bytes("s2")); + private final ColumnMetadata v1 = metadata.getColumn(ByteBufferUtil.bytes("v1")); + private final ColumnMetadata v2 = metadata.getColumn(ByteBufferUtil.bytes("v2")); ++ private final ColumnMetadata escaped = metadata.getColumn(ByteBufferUtil.bytes("Escaped Name")); 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)); @@@ -146,6 -151,23 +152,23 @@@ } @Test + public void testSelectEscapedColumn() + { + Consumer<ColumnFilter> check = filter -> { + testRoundTrips(filter); + assertEquals("[Escaped Name]", filter.toString()); + assertEquals("\"Escaped Name\"", filter.toCQLString()); + assertFetchedQueried(true, true, filter, escaped); + 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(escaped).build())); ++ check.accept(ColumnFilter.selection(RegularAndStaticColumns.builder().add(escaped).build())); + check.accept(ColumnFilter.selectionBuilder().add(escaped).build()); + } + + @Test public void testSelectComplexColumn() { Consumer<ColumnFilter> check = filter -> { @@@ -288,32 -319,26 +320,35 @@@ Consumer<ColumnFilter> check = filter -> { testRoundTrips(filter); assertFetchedQueried(true, true, filter, v1); - if (anyNodeOn30) + if ("3.0".equals(clusterMinVersion)) { assertEquals("*/*", filter.toString()); + assertEquals("*", filter.toCQLString()); 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 + else if ("3.11".equals(clusterMinVersion)) { assertEquals("*/[v1]", filter.toString()); + assertEquals("v1", filter.toCQLString()); 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); } + else + { + assertEquals("<all regulars>/[v1]", filter.toString()); ++ assertEquals("v1", filter.toCQLString()); + assertFetchedQueried(true, false, filter, v2); + assertFetchedQueried(false, false, filter, s1, s2); + assertCellFetchedQueried(true, false, filter, v2, path0, path1, path2, path3, path4); + assertCellFetchedQueried(false, false, filter, s2, path0, path1, path2, path3, path4); + } }; - check.accept(ColumnFilter.selection(metadata, PartitionColumns.builder().add(v1).build())); - check.accept(ColumnFilter.allColumnsBuilder(metadata).add(v1).build()); + check.accept(ColumnFilter.selection(metadata, RegularAndStaticColumns.builder().add(v1).build())); + check.accept(ColumnFilter.allRegularColumnsBuilder(metadata).add(v1).build()); } @Test @@@ -322,98 -347,78 +357,107 @@@ Consumer<ColumnFilter> check = filter -> { testRoundTrips(filter); assertFetchedQueried(true, true, filter, s1); - if (anyNodeOn30) + if ("3.0".equals(clusterMinVersion)) { assertEquals("*/*", filter.toString()); + assertEquals("*", filter.toCQLString()); assertFetchedQueried(true, true, filter, v1, v2, s2); assertCellFetchedQueried(true, true, filter, v2, path0, path1, path2, path3, path4); assertCellFetchedQueried(true, true, filter, s2, path0, path1, path2, path3, path4); } - else + else if ("3.11".equals(clusterMinVersion)) { assertEquals("*/[s1]", filter.toString()); + assertEquals("s1", filter.toCQLString()); assertFetchedQueried(true, false, filter, v1, v2, s2); assertCellFetchedQueried(true, false, filter, v2, path0, path1, path2, path3, path4); assertCellFetchedQueried(false, false, filter, s2, path0, path1, path2, path3, path4); } + else + { + assertEquals("<all regulars>+[s1]/[s1]", filter.toString()); ++ assertEquals("s1", filter.toCQLString()); + assertFetchedQueried(true, false, filter, v1, v2); + assertFetchedQueried(false, false, filter, s2); + assertCellFetchedQueried(true, false, filter, v2, path0, path1, path2, path3, path4); + assertCellFetchedQueried(false, false, filter, s2, path0, path1, path2, path3, path4); + } }; - check.accept(ColumnFilter.selection(metadata, PartitionColumns.builder().add(s1).build())); - check.accept(ColumnFilter.allColumnsBuilder(metadata).add(s1).build()); + check.accept(ColumnFilter.selection(metadata, RegularAndStaticColumns.builder().add(s1).build())); + check.accept(ColumnFilter.allRegularColumnsBuilder(metadata).add(s1).build()); } @Test public void testSelectCellWithMetadata() { - ColumnFilter filter = ColumnFilter.allColumnsBuilder(metadata).select(v2, path1).build(); + ColumnFilter filter = ColumnFilter.allRegularColumnsBuilder(metadata).select(v2, path1).build(); testRoundTrips(filter); assertFetchedQueried(true, true, filter, v2); - if (anyNodeOn30) + if ("3.0".equals(clusterMinVersion)) { assertEquals("*/*", filter.toString()); + assertEquals("*", filter.toCQLString()); assertFetchedQueried(true, true, filter, s1, s2, v1); assertCellFetchedQueried(true, true, filter, v2, path1); assertCellFetchedQueried(true, false, filter, v2, path0, path2, path3, path4); assertCellFetchedQueried(true, true, filter, s2, path0, path1, path2, path3, path4); } - else + else if ("3.11".equals(clusterMinVersion)) { assertEquals("*/[v2[1]]", filter.toString()); + assertEquals("v2[1]", filter.toCQLString()); assertFetchedQueried(true, false, filter, s1, s2, v1); assertCellFetchedQueried(true, true, filter, v2, path1); assertCellFetchedQueried(true, false, filter, v2, path0, path2, path3, path4); assertCellFetchedQueried(true, false, filter, s2, path0, path1, path2, path3, path4); } + else + { + assertEquals("<all regulars>/[v2[1]]", filter.toString()); ++ assertEquals("v2[1]", filter.toCQLString()); + assertFetchedQueried(true, false, filter, v1); + assertFetchedQueried(false, false, filter, s1, s2); + assertCellFetchedQueried(true, true, filter, v2, path1); + assertCellFetchedQueried(true, false, filter, v2, path0, path2, path3, path4); + assertCellFetchedQueried(false, false, filter, s2, path0, path1, path2, path3, path4); + } } @Test public void testSelectStaticColumnCellWithMetadata() { - ColumnFilter filter = ColumnFilter.allColumnsBuilder(metadata).select(s2, path1).build(); + ColumnFilter filter = ColumnFilter.allRegularColumnsBuilder(metadata).select(s2, path1).build(); testRoundTrips(filter); assertFetchedQueried(true, true, filter, s2); - if (anyNodeOn30) + if ("3.0".equals(clusterMinVersion)) { assertEquals("*/*", filter.toString()); + assertEquals("*", filter.toCQLString()); assertFetchedQueried(true, true, filter, v1, v2, s1); assertCellFetchedQueried(true, true, filter, v2, path0, path1, path2, path3, path4); assertCellFetchedQueried(true, true, filter, s2, path1); - assertCellFetchedQueried(true, false, filter, s2, path0, path2, path3, path4); + assertCellFetchedQueried(true, false, filter, s2, path0, path2, path3, path4); // TODO ??? } - else + else if ("3.11".equals(clusterMinVersion)) { assertEquals("*/[s2[1]]", filter.toString()); + assertEquals("s2[1]", filter.toCQLString()); assertFetchedQueried(true, false, filter, v1, v2, s1); assertCellFetchedQueried(true, false, filter, v2, path0, path1, path2, path3, path4); assertCellFetchedQueried(true, true, filter, s2, path1); assertCellFetchedQueried(true, false, filter, s2, path0, path2, path3, path4); } + else + { + assertEquals("<all regulars>+[s2[1]]/[s2[1]]", filter.toString()); ++ assertEquals("s2[1]", filter.toCQLString()); + assertFetchedQueried(true, false, filter, v1, v2); + assertFetchedQueried(false, false, filter, s1); + assertCellFetchedQueried(false, false, filter, v2, path0, path1, path2, path3, path4); + assertCellFetchedQueried(true, true, filter, s2, path1); + assertCellFetchedQueried(false, false, filter, s2, path0, path2, path3, path4); + } } private void testRoundTrips(ColumnFilter cf) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
