ekaterinadimitrova2 commented on code in PR #3095:
URL: https://github.com/apache/cassandra/pull/3095#discussion_r1568975222
##########
src/java/org/apache/cassandra/cql3/restrictions/RestrictionSet.java:
##########
@@ -171,179 +175,119 @@ public boolean hasRestrictionFor(ColumnMetadata.Kind
kind)
*/
public RestrictionSet addRestriction(SingleRestriction restriction)
{
- // RestrictionSet is immutable so we need to clone the restrictions
map.
- TreeMap<ColumnMetadata, SingleRestriction> newRestrictions = new
TreeMap<>(this.restrictions);
+ // RestrictionSet is immutable. Therefore, we need to clone the
restrictions map.
+ NavigableMap<ColumnMetadata, SingleRestriction> newRestricitons = new
TreeMap<>(this.restrictions);
- boolean newHasIn = hasIn || restriction.isIN();
- boolean newHasContains = hasContains || restriction.isContains();
+ boolean newHasIN = hasIn || restriction.isIN();
boolean newHasSlice = hasSlice || restriction.isSlice();
- boolean newHasAnn = hasAnn || restriction.isANN();
- boolean newHasOnlyEqualityRestrictions = hasOnlyEqualityRestrictions
&& (restriction.isEQ() || restriction.isIN());
+ boolean newHasANN = hasAnn || restriction.isANN();
+ boolean newNeedsFilteringOrIndexing = needsFilteringOrIndexing ||
restriction.needsFilteringOrIndexing();
- return new RestrictionSet(mergeRestrictions(newRestrictions,
restriction),
- hasMultiColumnRestrictions ||
restriction.isMultiColumn(),
- newHasIn,
- newHasContains,
+ return new RestrictionSet(mergeRestrictions(newRestricitons,
restriction),
+ newHasIN,
newHasSlice,
- newHasAnn,
- newHasOnlyEqualityRestrictions);
+ newHasANN,
+ newNeedsFilteringOrIndexing);
}
- private TreeMap<ColumnMetadata, SingleRestriction>
mergeRestrictions(TreeMap<ColumnMetadata, SingleRestriction> restrictions,
-
SingleRestriction restriction)
+ private NavigableMap<ColumnMetadata, SingleRestriction>
mergeRestrictions(NavigableMap<ColumnMetadata,SingleRestriction> restrictions,
+
SingleRestriction restriction)
{
- Collection<ColumnMetadata> columnDefs = restriction.getColumnDefs();
- Set<SingleRestriction> existingRestrictions =
getRestrictions(columnDefs);
+ Collection<ColumnMetadata> columns = restriction.columns();
+ Set<SingleRestriction> existings = getRestrictions(columns);
- if (existingRestrictions.isEmpty())
+ if (existings.isEmpty())
{
- for (ColumnMetadata columnDef : columnDefs)
- restrictions.put(columnDef, restriction);
+ for (ColumnMetadata column : columns)
+ restrictions.put(column, restriction);
}
else
{
- for (SingleRestriction existing : existingRestrictions)
+ for (SingleRestriction existing : existings)
{
SingleRestriction newRestriction = mergeRestrictions(existing,
restriction);
- for (ColumnMetadata columnDef : columnDefs)
- restrictions.put(columnDef, newRestriction);
+ for (ColumnMetadata column : newRestriction.columns())
Review Comment:
Oh, it seems I misread something, we did not change anything there. Closing
this one
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]