Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CNDB-12154 #1467

Draft
wants to merge 113 commits into
base: main-5.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
88085c7
Include checksums in CorruptBlockException when relevant (#1291)
michaeljmarshall Sep 19, 2024
29d2430
Implement FSError#getMessage to ensure file name is logged (#1292)
michaeljmarshall Sep 20, 2024
35e4038
Use query view's locked indexes for Plan#estimateAnnNodesVisited (#1238)
michaeljmarshall Sep 23, 2024
d09b969
CNDB-10923: Fix expressions accidentally joined by OR instead of AND
michaeljmarshall Sep 20, 2024
8c04f9c
Update src/java/org/apache/cassandra/db/filter/RowFilter.java
pkolaczk Sep 23, 2024
b6f2046
Update src/java/org/apache/cassandra/db/filter/RowFilter.java
pkolaczk Sep 23, 2024
46d4d15
Cleanup unused throws Throwable and other minor warnings
pkolaczk Sep 23, 2024
4eddc05
Remove unused enum variant
pkolaczk Sep 23, 2024
2d296a6
Revert "Use query view's locked indexes for Plan#estimateAnnNodesVisi…
michaeljmarshall Sep 24, 2024
ca61eec
CNDB-10862: Moves the deletion of index components on index drop to a…
pcmanus Sep 25, 2024
4761098
CNDB-10455: Automatically tune compaction for vector tables (#1265)
ethan-brown2022 Sep 25, 2024
a4c5c42
Add ShardManagerReplicaAware class to align UCS shards with replica s…
michaeljmarshall Sep 25, 2024
64a1aa4
CNDB-10988: inspect no space left exception on compaction (#1297)
jasonstack Sep 26, 2024
d4b7a54
CNDB-11048 ChunkCache eviction metrics improvements (#1303)
eolivelli Sep 27, 2024
2586d51
CNDB-10966: Add ability to read the TTLs and write times of the eleme…
adelapena Sep 24, 2024
e45beb7
CNDB-10939: Port CASSANDRA-19461 (index empty values)
adelapena Sep 16, 2024
36f06d1
CNDB-10870: Upgrade JVector dependency to 3.0.1
jkni Sep 30, 2024
b0feab1
CNDB-10945: Change calculation of sstable span for small sstables (#1…
blambov Oct 1, 2024
d2759f9
CNDB-11021: Improve performance of ORDER BY using KD-tree index
pkolaczk Sep 30, 2024
03b1881
CNDB-9850: Row-level trie memtable with DeletionInfo tombstone handling
blambov Jun 19, 2024
f6c8a6a
CNDB-9850 followup: Additional rebase changes to review
djatnieks Dec 2, 2024
86c00ae
CNDB-9850 followup: fix failing tests
djatnieks Dec 3, 2024
c1a3fb6
CNDB-9850 followup: Fix RowIndexTest
djatnieks Dec 4, 2024
7707d09
CNDB-9850 followup: Align ByteComparable.Version values with main branch
djatnieks Dec 3, 2024
7831acb
CNDB-10295 Followup - Do not use lambdas in InMemoryTrie (#1326)
eolivelli Oct 3, 2024
d246168
CNDB-11134: Fix data race in adjustForCrossDatacenterClashes to preve…
michaeljmarshall Oct 4, 2024
0de0951
Fix access to JDK internals for jamm post CNDB-9850
ekaterinadimitrova2 Oct 4, 2024
262b135
CNDB-10990: include archive size when constructing Bucket#constructAg…
jasonstack Oct 5, 2024
6ff57bf
CNDB-11028: Port CASSANDRA-18190, this fixes the tests for now, but m…
ekaterinadimitrova2 Sep 25, 2024
ad42706
CNDB-10783: Reuse CRC when appending index components
pkolaczk Sep 11, 2024
a373d3f
CC5 update IndexFileUtils to consistently use the version based getCh…
djatnieks Dec 3, 2024
47681b3
CNDB-10991: skip aggregate that includes any sstables that are alread…
jasonstack Oct 7, 2024
97b8d7f
CNDB-11090: add CompactionRealm#makeUCSEnvironment API (#1322)
jasonstack Oct 8, 2024
9ef942c
DSP-24330 QueryProcessor evictPrepared deadlock (#1257)
bereng Oct 8, 2024
28ac0b8
CNDB-8187 Add metrics about time spent writing SAI (compaction and fl…
eolivelli Oct 8, 2024
98cf299
CNDB-10886: Bump JVector to 3.0.2 (#1343)
jkni Oct 10, 2024
626e873
CNDB-8187 Move SAI writing metrics to micros and use counters (#1345)
eolivelli Oct 11, 2024
7541f42
CNDB-11283: Unify CQLTester#waitForIndex and SAITester#waitForIndexQu…
adelapena Oct 15, 2024
1899291
Add warning when rewriting TOC that does not exist (#1354)
pcmanus Oct 16, 2024
3569d65
CNDB-11336: Fix tests post JDK-8210522 (rewrite reflection of modifie…
ekaterinadimitrova2 Jun 10, 2024
527ccbd
CNDB-11092: Fix IndexInputLeakDetector (#1310)
adelapena Oct 16, 2024
2a6a311
CNDB-10629: Estimate predicate selectivity using histograms
pkolaczk Aug 27, 2024
9bd6ad1
Revert Version.LATEST to DB (#1364)
pkolaczk Oct 17, 2024
4c1b32d
CNDB-10988: fix CompactionOutOfSpaceTest by wrapping IOException with…
jasonstack Oct 17, 2024
3a15aba
CNDB-11338: Fix ClassCastException from jdk GaloisCounterMode when u…
ekaterinadimitrova2 Oct 18, 2024
5b2fb66
CNDB-9877: Add pull request template (#1368)
jacek-lewandowski Oct 21, 2024
2149b5b
CNDB-11345: mock CFS#makeUCSEnvironment in ControllerTest (#1360)
michaeljmarshall Oct 21, 2024
3eb89ac
CNDB-11388: Set timeout when waiting on futures in ChunkCache.rebuffe…
jkni Oct 22, 2024
6515b3a
CNDB-10716: do not use lambdas as they don't work with Jamm 3 on JDK2…
eolivelli Oct 23, 2024
7345020
CNDB-11398: Fix concurrency issues with new TrieMemtable (#1371)
blambov Oct 23, 2024
7c12281
CNDB-11133: Port CASSANDRA-17224, CASSANDRA-18267, CASSANDRA-17294 an…
ekaterinadimitrova2 Oct 23, 2024
475ba3a
CNDB-11217: Implemenet DelegatingShardManager (#1339)
michaeljmarshall Oct 23, 2024
15c23c9
CNDB-11210: Fix false negatives for non-eq (#1359)
k-rus Oct 24, 2024
d6508c7
CNDB-11438 main: Fix CompactionStrategyStatisticsTest (#1378)
djatnieks Oct 24, 2024
7e54436
CNDB-11210 simplify test of Non-eq on truncated types (#1381)
k-rus Oct 25, 2024
301b89d
CNDB-11219: Make TokenAllocatorBase take a supplier for first token a…
michaeljmarshall Oct 28, 2024
c8ccb4f
CNDB-11492: Bump up Version.LATEST to DC
pkolaczk Oct 28, 2024
9d1b66b
CNDB-1461: add REPLACE reload reason (#975)
jasonstack Oct 29, 2024
1516421
CNDB-11519: Apply pk restriction earlier in hybrid sai execution (#1391)
michaeljmarshall Oct 29, 2024
5b7e78a
CNDB-11498: Make main branch compile on JDK22 (#1385)
ekaterinadimitrova2 Oct 30, 2024
152c9d7
CNDB-11434: Refactor tests to mitigate https://openjdk.org/jeps/416 (…
ekaterinadimitrova2 Oct 30, 2024
221f776
CNDB-11518: Split o.a.c.index.sai.cql.VectorTypeTest to prevent timeo…
adelapena Oct 31, 2024
3041d26
CNDB-11459 and 11413: More logging for SAI vector index events (#1404)
michaeljmarshall Nov 5, 2024
878d032
CNDB-11579: Rewrite MessagePayloadTest to account for JEP 416
ekaterinadimitrova2 Nov 4, 2024
6dc1d0e
CNDB-11579: Use try-with-resources in MessagePayloadTest
ekaterinadimitrova2 Nov 5, 2024
88dafb0
CNDB-11499: Fix incorrect thread names in CompactionControllerTest
blambov Nov 5, 2024
eb85f95
CNDB-11563 move and rename SAI iterators and postings as in ASF (#1400)
k-rus Nov 7, 2024
2638063
CNDB-11441: Port update SyncUtil for JDK11 and JDK17
ekaterinadimitrova2 Jun 28, 2023
3dc2722
CNDB-11663: Handle posting list ordinal assignment race (#1410)
michaeljmarshall Nov 7, 2024
96a3d0b
CNDB-11646: Reclaculate ShardManager#minimumPerPartitionSpan on each …
michaeljmarshall Nov 7, 2024
c64eb5e
Rename few iterators to KeyRangeIterator
k-rus Nov 8, 2024
1b7fea9
CNDB-11630: Minimal port of CASSANDRA-18049 and additional fixes arou…
ekaterinadimitrova2 Nov 12, 2024
47589d2
CNDB-11118 return null serializer if response verb is null (#1328)
jtgrabowski Nov 13, 2024
95361eb
CNDB-11678: Use DenseIntMap for CassandraOnHeapGraph (#1418)
michaeljmarshall Nov 14, 2024
3d18d6c
Allow custom SAI components discovery (#1338)
pcmanus Nov 14, 2024
f4a26bd
CNDB-10731: Add support for index analyzers to RowFilter (#1270)
adelapena Nov 14, 2024
30a1094
CNDB-10085: Add guardrail for the number of column filters per query …
adelapena Nov 19, 2024
e70e5de
CNDB-8491: add existing sstables into SAI even if intiial build is sk…
jasonstack Nov 19, 2024
2a115b6
CNDB-11680: Add source sstable/memtable id to vector traces (#1411)
michaeljmarshall Nov 20, 2024
945002f
HCD-18 add option to ignore DC name validation (#1428)
shunsaker Nov 21, 2024
34c38be
CNDB-11801: custom stage exeuctors
jakubzytka Nov 19, 2024
d240fcf
CNDB-11801: test for the functionality of using a custom stage executor
jakubzytka Nov 19, 2024
fa79f58
CNDB-9046: cross-node messaging metrics fixes
jakubzytka Nov 4, 2024
6c0d818
Fix minor bug in intersection's propagate access (#1430)
k-rus Nov 25, 2024
bc2d573
CNDB-11782: additional messaging metrics
jakubzytka Nov 18, 2024
5e880de
CNDB-11581: Stage metrics improvements
jakubzytka Nov 18, 2024
680024b
CNDB-11714: Optimize SAI ORDER BY row materialization (#1419)
michaeljmarshall Nov 26, 2024
ba82683
CNDB-11832: add LifecycleNewTracker#trackNewWritten when sstable and …
jasonstack Nov 28, 2024
a4932a1
CNDB-10851 Lower paxos max backoff sleep from 100 to 50 ms (#1444)
jtgrabowski Nov 28, 2024
2d1b768
CNDB-11768: DynamicEndpointSnitch tweaks: quantization and quantile i…
jakubzytka Nov 29, 2024
1595cc2
CNDB-11760: Prevent full deserialization in CQL's CONTAINS operator (…
adelapena Nov 29, 2024
97d1301
CNDB-11655: Limit the number of clauses before optimizing the Plan
pkolaczk Nov 15, 2024
77861d4
CNDB-11742: Add a client warning when using an n-gram analyzer withou…
adelapena Dec 2, 2024
83a97ea
CNDB-10732: Reproduction tests and fixes for CNDB-10732 and CNDB-1053…
ekaterinadimitrova2 Dec 2, 2024
5411d56
Add method to check if component diff creates unused components (#1438)
pcmanus Dec 3, 2024
3ccd01d
CNDB-11988: Bump jvector to 3.0.4 (#1450)
michaeljmarshall Dec 4, 2024
90aa046
CNDB-10759 Make native transport stage async in regards to read and w…
jakubzytka Dec 6, 2024
faec14b
CNDB-11950: cache sstable density result to speed up test (#1454)
michaeljmarshall Dec 6, 2024
926fee7
CNDB-11762: Remove StorageAttachedIndexQueryPlan#postProcessor (#1422)
adelapena Dec 9, 2024
9e812ac
CNDB-12051: addtional tracing messages about query execution (#1459)
jakubzytka Dec 10, 2024
5d2df65
CNDB-11495: add REMOTE_STORAGE_HANDLER_FACTORY (#1443)
jasonstack Dec 11, 2024
4418146
CNDB-10718: Make RowFilter non-iterable (#1448)
adelapena Dec 12, 2024
88edb5b
CNDB-11932 plan union of half-ranges for inequality (#1451)
k-rus Dec 12, 2024
4e8143c
SAI: Reduce DirectReader object creation (#1011)
michaeljmarshall Dec 12, 2024
7febcba
STAR-1872: Parallelize UCS compactions per output shard (#1342)
blambov Dec 13, 2024
5a9a04f
CNDB-12130: read source file sequentially when sending file through Z…
jasonstack Dec 16, 2024
bf4ab4c
CNDB-12128 Expose to CNDB some methods around ExpirationTask (#1465)
eolivelli Dec 16, 2024
13f1f59
CNDB-11070: Limited backport of CASSANDRA-19534 (#1460)
jkni Dec 16, 2024
ad7ee6b
CNDB-12120: 3 test failures in MultiNodeBillingTest (#1462)
adelapena Dec 16, 2024
bbc7f67
DSP-24606: Replace nulls with negative defaults in system_schema (#1445)
szymon-miezal Dec 16, 2024
7c0097e
CNDB-11242: Allow to specify a custom cluster version provider (#1458)
jacek-lewandowski Dec 16, 2024
762f657
CNDB-12139 minor refactor row count estimation code (#1463)
k-rus Dec 17, 2024
7fdd10d
CC5 Fix for CNDB-11070 to use 'native_transport_timeout' as 5.0 name …
djatnieks Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .build/parent-pom-template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@
<dependency>
<groupId>io.github.jbellis</groupId>
<artifactId>jvector</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.carrotsearch.randomizedtesting</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,19 +795,27 @@ public enum CassandraRelevantProperties
*/
UCS_COMPACTION_AGGREGATE_PRIORITIZER("unified_compaction.custom_compaction_aggregate_prioritizer"),
UCS_DATASET_SIZE("unified_compaction.dataset_size"),
UCS_IS_REPLICA_AWARE("unified_compaction.is_replica_aware"),
UCS_L0_SHARDS_ENABLED("unified_compaction.l0_shards_enabled", "true"),
UCS_MAX_ADAPTIVE_COMPACTIONS("unified_compaction.max_adaptive_compactions", "5"),
UCS_MAX_SPACE_OVERHEAD("unified_compaction.max_space_overhead", "0.2"),
UCS_MIN_SSTABLE_SIZE("unified_compaction.min_sstable_size", "100MiB"),
UCS_NUM_SHARDS("unified_compaction.num_shards"),
UCS_OVERLAP_INCLUSION_METHOD("unified_compaction.overlap_inclusion_method"),
UCS_OVERRIDE_UCS_CONFIG_FOR_VECTOR_TABLES("unified_compaction.override_ucs_config_for_vector_tables", "false"),
UCS_RESERVATIONS_TYPE_OPTION("unified_compaction.reservations_type_option", Reservations.Type.LEVEL_OR_BELOW.name()),
UCS_RESERVED_THREADS("reserved_threads", "max"),
UCS_SHARED_STORAGE("unified_compaction.shared_storage", "false"),
UCS_SSTABLE_GROWTH("unified_compaction.sstable_growth", "0.5"),
UCS_SSTABLE_GROWTH("unified_compaction.sstable_growth", "0.333"),
UCS_STATIC_SCALING_PARAMETERS("unified_compaction.scaling_parameters", "T4"),
UCS_SURVIVAL_FACTOR("unified_compaction.survival_factor", "1"),
UCS_TARGET_SSTABLE_SIZE("unified_compaction.target_sstable_size", "5GiB"),
UCS_TARGET_SSTABLE_SIZE("unified_compaction.target_sstable_size", "1GiB"),
UCS_VECTOR_BASE_SHARD_COUNT("unified_compaction.vector_base_shard_count", "1"),
UCS_VECTOR_MIN_SSTABLE_SIZE("unified_compaction.vector_min_sstable_size", "1024MiB"),
UCS_VECTOR_RESERVED_THREADS("unified_compaction.vector_reserved_threads", "max"),
UCS_VECTOR_SCALING_PARAMETERS("unified_compaction.vector_scaling_parameters", "-8"),
UCS_VECTOR_SSTABLE_GROWTH("unified_compaction.vector_sstable_growth", "1.0"),
UCS_VECTOR_TARGET_SSTABLE_SIZE("unified_compaction.vector_target_sstable_size", "5GiB"),
UDF_EXECUTOR_THREAD_KEEPALIVE_MS("cassandra.udf_executor_thread_keepalive_ms", "30000"),
UNSAFE_SYSTEM("cassandra.unsafesystem"),
/** User's home directory. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public void addToRowFilter(RowFilter.Builder rowFilter,
QueryOptions options) throws InvalidRequestException
{
for (SingleRestriction restriction : restrictionsMap.values())
restriction.addToRowFilter(rowFilter, indexRegistry, options);
rowFilter.addAllAsConjunction(b -> restriction.addToRowFilter(b, indexRegistry, options));
}

@Override
Expand Down
82 changes: 29 additions & 53 deletions src/java/org/apache/cassandra/cql3/selection/Selectable.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

public interface Selectable extends AssignmentTestable
{
public Selector.Factory newSelectorFactory(TableMetadata table, AbstractType<?> expectedType, List<ColumnMetadata> defs, VariableSpecifications boundNames);
Selector.Factory newSelectorFactory(TableMetadata table, AbstractType<?> expectedType, List<ColumnMetadata> defs, VariableSpecifications boundNames);

/**
* The type of the {@code Selectable} if it can be infered.
Expand All @@ -81,22 +81,22 @@ public interface Selectable extends AssignmentTestable
* literals, the exact type is not inferrable since they are valid for many
* different types and so this will return {@code null} too).
*/
public AbstractType<?> getExactTypeIfKnown(String keyspace);
AbstractType<?> getExactTypeIfKnown(String keyspace);

/**
* Checks if this {@code Selectable} select columns matching the specified predicate.
* @return {@code true} if this {@code Selectable} select columns matching the specified predicate,
* {@code false} otherwise.
*/
public boolean selectColumns(Predicate<ColumnMetadata> predicate);
boolean selectColumns(Predicate<ColumnMetadata> predicate);

/**
* Checks if the specified Selectables select columns matching the specified predicate.
* @param selectables the selectables to check.
* @return {@code true} if the specified Selectables select columns matching the specified predicate,
{@code false} otherwise.
*/
public static boolean selectColumns(List<Selectable> selectables, Predicate<ColumnMetadata> predicate)
static boolean selectColumns(List<Selectable> selectables, Predicate<ColumnMetadata> predicate)
{
for (Selectable selectable : selectables)
{
Expand All @@ -110,21 +110,21 @@ public static boolean selectColumns(List<Selectable> selectables, Predicate<Colu
* Checks if any processing is performed on the selected columns, {@code false} otherwise.
* @return {@code true} if any processing is performed on the selected columns, {@code false} otherwise.
*/
public default boolean processesSelection()
default boolean processesSelection()
{
// ColumnMetadata is the only case that returns false (if the column is not masked) and overrides this
return true;
}

// Term.Raw overrides this since some literals can be WEAKLY_ASSIGNABLE
default public TestResult testAssignment(String keyspace, ColumnSpecification receiver)
default TestResult testAssignment(String keyspace, ColumnSpecification receiver)
{
AbstractType<?> type = getExactTypeIfKnown(keyspace);
return type == null ? TestResult.NOT_ASSIGNABLE : type.testAssignment(keyspace, receiver);
}

@Override
public default AbstractType<?> getCompatibleTypeIfKnown(String keyspace)
default AbstractType<?> getCompatibleTypeIfKnown(String keyspace)
{
return getExactTypeIfKnown(keyspace);
}
Expand Down Expand Up @@ -168,12 +168,12 @@ default void validateType(TableMetadata table, AbstractType<?> type)
throw invalidRequest("%s is not of the expected type: %s", this, type.asCQL3Type());
}

public interface Raw
interface Raw
{
public Selectable prepare(TableMetadata table);
Selectable prepare(TableMetadata table);
}

public static class WithTerm implements Selectable
class WithTerm implements Selectable
{
/**
* The names given to unamed bind markers found in selection. In selection clause, we often don't have a good
Expand Down Expand Up @@ -282,7 +282,7 @@ public Selectable prepare(TableMetadata table)
}
}

public static class WritetimeOrTTL implements Selectable
class WritetimeOrTTL implements Selectable
{
// The order of the variants in the Kind enum matters as they are used in ser/deser
public enum Kind
Expand Down Expand Up @@ -379,7 +379,7 @@ public WritetimeOrTTL prepare(TableMetadata table)
}
}

public static class WithFunction implements Selectable
class WithFunction implements Selectable
{
public final Function function;
public final List<Selectable> args;
Expand Down Expand Up @@ -477,7 +477,7 @@ public Selectable prepare(TableMetadata table)
}
}

public static class WithCast implements Selectable
class WithCast implements Selectable
{
private final CQL3Type type;
private final Selectable arg;
Expand Down Expand Up @@ -549,7 +549,7 @@ public WithCast prepare(TableMetadata table)
/**
* Represents the selection of the field of a UDT (eg. t.f).
*/
public static class WithFieldSelection implements Selectable
class WithFieldSelection implements Selectable
{
public final Selectable selected;
public final FieldIdentifier field;
Expand Down Expand Up @@ -601,7 +601,7 @@ public Selector.Factory newSelectorFactory(TableMetadata table, AbstractType<?>
public AbstractType<?> getExactTypeIfKnown(String keyspace)
{
AbstractType<?> selectedType = selected.getExactTypeIfKnown(keyspace);
if (selectedType == null || !(selectedType instanceof UserType))
if (!(selectedType instanceof UserType))
return null;

UserType ut = (UserType) selectedType;
Expand Down Expand Up @@ -641,7 +641,7 @@ public WithFieldSelection prepare(TableMetadata table)
* <p>The parser cannot differentiate between a single element between parentheses or a single element tuple.
* By consequence, we are forced to wait until the type is known to be able to differentiate them.</p>
*/
public static class BetweenParenthesesOrWithTuple implements Selectable
class BetweenParenthesesOrWithTuple implements Selectable
{
/**
* The tuple elements or the element between the parentheses
Expand Down Expand Up @@ -915,18 +915,6 @@ public AbstractType<?> getCompatibleTypeIfKnown(String keyspace)
{
return Lists.getPreferredCompatibleType(selectables, p -> p.getCompatibleTypeIfKnown(keyspace));
}

@Override
public boolean selectColumns(Predicate<ColumnMetadata> predicate)
{
return Selectable.selectColumns(selectables, predicate);
}

@Override
public String toString()
{
return Lists.listToString(selectables);
}
}

public static class WithVector extends WithArrayLiteral
Expand Down Expand Up @@ -984,24 +972,12 @@ public AbstractType<?> getCompatibleTypeIfKnown(String keyspace)
{
return Vectors.getPreferredCompatibleType(selectables, p -> p.getCompatibleTypeIfKnown(keyspace));
}

@Override
public boolean selectColumns(Predicate<ColumnMetadata> predicate)
{
return Selectable.selectColumns(selectables, predicate);
}

@Override
public String toString()
{
return Lists.listToString(selectables);
}
}

/**
* <code>Selectable</code> for literal Sets.
*/
public static class WithSet implements Selectable
class WithSet implements Selectable
{
/**
* The set elements
Expand Down Expand Up @@ -1104,7 +1080,7 @@ public Selectable prepare(TableMetadata cfm)
* {@code ColumnIdentifier} is equivalent to a {@code FieldIdentifier} from a syntax point of view.
* By consequence, we are forced to wait until the type is known to be able to differentiate them.</p>
*/
public static class WithMapOrUdt implements Selectable
class WithMapOrUdt implements Selectable
{
/**
* The column family metadata. We need to store them to be able to build the proper data once the type has been
Expand Down Expand Up @@ -1289,7 +1265,7 @@ public Selectable prepare(TableMetadata cfm)
/**
* <code>Selectable</code> for type hints (e.g. (int) ?).
*/
public static class WithTypeHint implements Selectable
class WithTypeHint implements Selectable
{

/**
Expand Down Expand Up @@ -1401,7 +1377,7 @@ public Selectable prepare(TableMetadata cfm)
* identifier have the same syntax. By consequence, we need to wait until the type is known to create the proper
* Object: {@code ColumnMetadata} or {@code FieldIdentifier}.
*/
public static final class RawIdentifier implements Selectable.Raw
final class RawIdentifier implements Selectable.Raw
{
private final String text;

Expand Down Expand Up @@ -1456,7 +1432,7 @@ public String toString()
/**
* Represents the selection of an element of a collection (eg. c[x]).
*/
public static class WithElementSelection implements Selectable
class WithElementSelection implements Selectable
{
public final Selectable selected;
// Note that we can't yet prepare the Term.Raw yet as we need the ColumnSpecificiation corresponding to Selectable, which
Expand Down Expand Up @@ -1487,20 +1463,20 @@ public Selector.Factory newSelectorFactory(TableMetadata cfm, AbstractType<?> ex
if (!(type instanceof CollectionType))
throw new InvalidRequestException(String.format("Invalid element selection: %s is of type %s is not a collection", selected, type.asCQL3Type()));

ColumnSpecification boundSpec = specForElementOrSlice(selected, receiver, ((CollectionType) type).kind, "Element");
ColumnSpecification boundSpec = specForElementOrSlice(selected, receiver, ((CollectionType<?>) type).kind, "Element");

Term elt = element.prepare(cfm.keyspace, boundSpec);
elt.collectMarkerSpecification(boundNames);
return ElementsSelector.newElementFactory(toString(), factory, (CollectionType)type, elt);
return ElementsSelector.newElementFactory(toString(), factory, (CollectionType<?>)type, elt);
}

public AbstractType<?> getExactTypeIfKnown(String keyspace)
{
AbstractType<?> selectedType = selected.getExactTypeIfKnown(keyspace);
if (selectedType == null || !(selectedType instanceof CollectionType))
if (!(selectedType instanceof CollectionType))
return null;

return ElementsSelector.valueType((CollectionType) selectedType);
return ElementsSelector.valueType((CollectionType<?>) selectedType);
}

@Override
Expand Down Expand Up @@ -1536,7 +1512,7 @@ public String toString()
/**
* Represents the selection of a slice of a collection (eg. c[x..y]).
*/
public static class WithSliceSelection implements Selectable
class WithSliceSelection implements Selectable
{
public final Selectable selected;
// Note that we can't yet prepare the Term.Raw yet as we need the ColumnSpecificiation corresponding to Selectable, which
Expand Down Expand Up @@ -1570,21 +1546,21 @@ public Selector.Factory newSelectorFactory(TableMetadata cfm, AbstractType<?> ex
if (!(type instanceof CollectionType))
throw new InvalidRequestException(String.format("Invalid slice selection: %s of type %s is not a collection", selected, type.asCQL3Type()));

ColumnSpecification boundSpec = specForElementOrSlice(selected, receiver, ((CollectionType) type).kind, "Slice");
ColumnSpecification boundSpec = specForElementOrSlice(selected, receiver, ((CollectionType<?>) type).kind, "Slice");

// If from or to are null, this means the user didn't provide on in the syntax (we had c[x..] or c[..x]).
// The equivalent of doing this when preparing values would be to use UNSET.
Term f = from == null ? Constants.UNSET_VALUE : from.prepare(cfm.keyspace, boundSpec);
Term t = to == null ? Constants.UNSET_VALUE : to.prepare(cfm.keyspace, boundSpec);
f.collectMarkerSpecification(boundNames);
t.collectMarkerSpecification(boundNames);
return ElementsSelector.newSliceFactory(toString(), factory, (CollectionType)type, f, t);
return ElementsSelector.newSliceFactory(toString(), factory, (CollectionType<?>) type, f, t);
}

public AbstractType<?> getExactTypeIfKnown(String keyspace)
{
AbstractType<?> selectedType = selected.getExactTypeIfKnown(keyspace);
if (selectedType == null || !(selectedType instanceof CollectionType))
if (!(selectedType instanceof CollectionType))
return null;

return selectedType;
Expand Down
14 changes: 7 additions & 7 deletions src/java/org/apache/cassandra/cql3/selection/Selection.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,14 @@ private static List<ByteBuffer> rowToJson(List<ByteBuffer> row,
return Arrays.asList(jsonRow);
}

public static interface Selectors
public interface Selectors
{
/**
* Returns the {@code ColumnFilter} corresponding to those selectors
*
* @return the {@code ColumnFilter} corresponding to those selectors
*/
public ColumnFilter getColumnFilter();
ColumnFilter getColumnFilter();

/**
* Checks if this Selectors perform some processing
Expand All @@ -363,19 +363,19 @@ public static interface Selectors
* Checks if one of the selectors perform some aggregations.
* @return {@code true} if one of the selectors perform some aggregations, {@code false} otherwise.
*/
public boolean isAggregate();
boolean isAggregate();

/**
* Returns the number of fetched columns
* @return the number of fetched columns
*/
public int numberOfFetchedColumns();
int numberOfFetchedColumns();

/**
* Checks if one of the selectors collect TTLs.
* @return {@code true} if one of the selectors collect TTLs, {@code false} otherwise.
*/
public boolean collectTTLs();
boolean collectTTLs();

/**
* Checks if one of the selectors collects write timestamps.
Expand All @@ -390,9 +390,9 @@ public static interface Selectors
*/
public void addInputRow(InputRow input);

public List<ByteBuffer> getOutputRow();
List<ByteBuffer> getOutputRow();

public void reset();
void reset();
}

// Special cased selection for when only columns are selected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public void addFetchedColumns(ColumnFilter.Builder builder)
};
}

@Override
public void addFetchedColumns(ColumnFilter.Builder builder)
{
selected.addFetchedColumns(builder);
Expand Down Expand Up @@ -146,18 +147,21 @@ public void addInput(InputRow input)
}
}

@Override
public ByteBuffer getOutput(ProtocolVersion protocolVersion)
{
return current;
}

@Override
public void reset()
{
selected.reset();
isSet = false;
current = null;
}

@Override
public AbstractType<?> getType()
{
AbstractType<?> type = kind.returnType;
Expand Down
Loading