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


##########
test/harry/main/org/apache/cassandra/harry/model/ASTSingleTableModelTest.java:
##########
@@ -557,6 +563,60 @@ public void deleteRowImpactsSearch()
                                     .build());
     }
 
+    @Test
+    public void testClusteringRangeDelete()
+    {
+        TableMetadata metadata = new 
Builder().pk(1).ck(1).statics(0).regular(1).build();
+        ASTSingleTableModel model = new ASTSingleTableModel(metadata);
+
+        for (int i = 0; i < 10; i++)
+        {
+            model.update(Mutation.insert(metadata)
+                                 .value("pk", 0)
+                                 .value("ck", i)
+                                 .value("v", i)
+                                 .build());
+        }
+
+        model.update(Mutation.delete(metadata)
+                             .value("pk", 0)
+                             .where("ck", Inequality.GREATER_THAN_EQ, 0)
+                             .where("ck", Inequality.LESS_THAN, 7)
+                             .build());
+
+        model.validate(rows(row(metadata, 0, 7, 7), row(metadata, 0, 8, 8), 
row(metadata,0,9,9)),
+                       Select.builder(metadata).value("pk", 0)
+                             .where("ck", Inequality.GREATER_THAN_EQ, 0)
+                             .where("ck", Inequality.LESS_THAN_EQ, 9).build());
+    }
+

Review Comment:
   nit: The two other tests I would consider adding here, just to get simple 
model problems out of the way, are a.) something with more than one clustering 
key and b.) something w/ a static column.



##########
test/harry/main/org/apache/cassandra/harry/model/ASTSingleTableModelTest.java:
##########
@@ -557,6 +563,60 @@ public void deleteRowImpactsSearch()
                                     .build());
     }
 
+    @Test
+    public void testClusteringRangeDelete()
+    {
+        TableMetadata metadata = new 
Builder().pk(1).ck(1).statics(0).regular(1).build();
+        ASTSingleTableModel model = new ASTSingleTableModel(metadata);
+
+        for (int i = 0; i < 10; i++)
+        {
+            model.update(Mutation.insert(metadata)
+                                 .value("pk", 0)
+                                 .value("ck", i)
+                                 .value("v", i)
+                                 .build());
+        }
+
+        model.update(Mutation.delete(metadata)
+                             .value("pk", 0)
+                             .where("ck", Inequality.GREATER_THAN_EQ, 0)
+                             .where("ck", Inequality.LESS_THAN, 7)
+                             .build());
+
+        model.validate(rows(row(metadata, 0, 7, 7), row(metadata, 0, 8, 8), 
row(metadata,0,9,9)),
+                       Select.builder(metadata).value("pk", 0)
+                             .where("ck", Inequality.GREATER_THAN_EQ, 0)
+                             .where("ck", Inequality.LESS_THAN_EQ, 9).build());
+    }
+
+
+    @Test
+    public void testClusteringRangeDeleteBetween()
+    {
+        TableMetadata metadata = new 
Builder().pk(1).ck(1).statics(0).regular(1).build();
+        ASTSingleTableModel model = new ASTSingleTableModel(metadata);
+
+        for (int i = 0; i < 10; i++)
+        {
+            model.update(Mutation.insert(metadata)
+                                 .value("pk", 0)
+                                 .value("ck", i)
+                                 .value("v", i)
+                                 .build());
+        }
+
+        model.update(Mutation.delete(metadata)
+                             .value("pk", 0)
+                             .between("ck", Bind.of(0), Literal.of(6))
+                             .build());
+
+        model.validate(rows(row(metadata, 0, 7, 7), row(metadata, 0, 8, 8), 
row(metadata,0,9,9)),
+                       Select.builder(metadata).value("pk", 0)
+                             .where("ck", Inequality.GREATER_THAN_EQ, 0)
+                             .where("ck", Inequality.LESS_THAN_EQ, 9).build());

Review Comment:
   Same issue as above in 
https://github.com/apache/cassandra/pull/4222/changes#r3012085588



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