dcapwell commented on code in PR #4222:
URL: https://github.com/apache/cassandra/pull/4222#discussion_r2192936676
##########
test/harry/main/org/apache/cassandra/harry/model/ASTSingleTableModel.java:
##########
@@ -811,6 +852,79 @@ else if (c instanceof Conditional.In)
other.add(c);
}
}
+ if (!rangeConditions.isEmpty())
+ {
+
+ Slices.Builder builder = new
Slices.Builder(factory.clusteringComparator);
+
+ for (Map.Entry<Symbol, List<Conditional.Where>> entry :
rangeConditions.entrySet())
+ {
+ List<Conditional.Where> conds = entry.getValue();
+ ByteBuffer lower = null;
+ ByteBuffer upper = null;
+ boolean includeLower = false;
+ boolean includeUpper = false;
+
+ for (Conditional.Where cond : conds)
+ {
+ ByteBuffer val = eval(cond.rhs);
+ switch (cond.kind)
+ {
+ case GREATER_THAN: lower = val; includeLower = false;
break;
+ case GREATER_THAN_EQ: lower = val; includeLower =
true; break;
+ case LESS_THAN: upper = val; includeUpper = false;
break;
+ case LESS_THAN_EQ: upper = val; includeUpper = true;
break;
+ }
+ }
+
+ ClusteringBound start, end;
+
+ if (lower == null)
+ {
+ start = ClusteringBound.BOTTOM;
+ }
+ else
+ {
+ if (includeLower)
+ start =
ClusteringBound.inclusiveStartOf(factory.clusteringComparator.make(lower));
+ else
+ start =
ClusteringBound.exclusiveStartOf(factory.clusteringComparator.make(lower));
+ }
+
+
+ if (upper == null)
+ {
+ end = ClusteringBound.TOP;
+ }
+ else
+ {
+ if (includeUpper)
+ end =
ClusteringBound.inclusiveEndOf(factory.clusteringComparator.make(upper));
+ else
+ end =
ClusteringBound.exclusiveEndOf(factory.clusteringComparator.make(upper));
+ }
+
+ builder.add(Slice.make(start, end));
+ }
+
+ Slices slices = builder.build();
+
+ List<Clustering<ByteBuffer>> clusterings = new ArrayList<>();
+
+ for (Slice slice : slices)
+ {
+ ClusteringBound<?> start = slice.start();
+ ClusteringBound<?> end = slice.end();
+
+ if (!start.isBottom())
+ clusterings.add(createClusteringBound(start));
+
+ if (!end.isTop())
+ clusterings.add(createClusteringBound(start));
+ }
+ return Pair.create(clusterings, other);
Review Comment:
this isn't correct... this method works with equality and not bounds, so
returning bounds will yield incorrect responses. I think you can just drop all
changes to this method as you have to special case range delete anyways
*before* you call this method on clustering columns
--
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]