maedhroz commented on code in PR #2943:
URL: https://github.com/apache/cassandra/pull/2943#discussion_r1409765620


##########
test/unit/org/apache/cassandra/index/sai/cql/RandomItersectionTest.java:
##########
@@ -0,0 +1,209 @@
+/*
+ * 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.index.sai.cql;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.cassandra.index.sai.utils.SAIRandomizedTester;
+
+public class RandomItersectionTest extends SAIRandomizedTester
+{
+    private int numRows;
+
+    @Before
+    public void createTableAndIndexes()
+    {
+        createTable("CREATE TABLE %s (pk int, ck int, v1 int, v2 int, PRIMARY 
KEY(pk, ck))");
+        createIndex("CREATE INDEX ON %s(v1) USING 'sai'");
+        createIndex("CREATE INDEX ON %s(v2) USING 'sai'");
+
+        numRows = nextInt(50000, 200000);
+    }
+
+    @Test
+    public void smallPartitionPartitionRestrictedTest()
+    {
+        Map<Integer, List<TestRow>> testRowMap = buildAndLoadTestRows(false);
+
+        for (int queryCount = 0; queryCount < nextInt(10, 100); queryCount++)
+        {
+            int pk = testRowMap.keySet().stream().skip(nextInt(0, 
testRowMap.size())).findFirst().get();
+            int v1 = nextInt(10, numRows/10);

Review Comment:
   I wonder if we could wrap these up in some `nextV1()` / `nextV2()` methods 
or something. If we want to tweak the range, it would be easier to do it in one 
place I guess. I ran through all this a few times, and it does look like we get 
a reasonable spread of result set sizes, and every once in a while, no matches.



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