dcapwell commented on code in PR #2948:
URL: https://github.com/apache/cassandra/pull/2948#discussion_r1411086969


##########
src/java/org/apache/cassandra/dht/Range.java:
##########
@@ -942,6 +946,24 @@ public static <T extends RingPosition<T>> boolean 
equals(Collection<Range<T>> a,
         return normalize(a).equals(normalize(b));
     }
 
+    public static accord.primitives.Ranges toAccord(String ks, 
Collection<Range<Token>> ranges)
+    {
+        List<Range<Token>> normalizedRanges = Range.normalize(ranges);
+        TokenRange[] tokenRanges = new TokenRange[normalizedRanges.size()];
+        for (int i = 0; i < normalizedRanges.size(); i++)
+        {
+            Range<Token> tokenRange = normalizedRanges.get(i);
+            AccordRoutingKey left = new TokenKey(ks, tokenRange.left);
+            AccordRoutingKey right = new TokenKey(ks, tokenRange.right);
+            if (tokenRange.left.isMinimum())
+                left = AccordRoutingKey.SentinelKey.min(ks);
+            if (tokenRange.right.isMinimum())
+                right = AccordRoutingKey.SentinelKey.max(ks);

Review Comment:
   @bdeggleston mind sanity checking this?  I believe its correct, but just 
wanted to double check.



-- 
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]

Reply via email to