xtern commented on code in PR #2282:
URL: https://github.com/apache/ignite-3/pull/2282#discussion_r1254590091


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItSecondaryIndexTest.java:
##########
@@ -993,4 +993,60 @@ public void testSaturatedBoundsHashIndex() {
 
         assertQuery("SELECT * FROM t200 WHERE val = 
1024").returnNothing().check();
     }
+
+    @Test
+    public void testScanBooleanField() {
+        try {
+            sql("CREATE TABLE t(i INTEGER PRIMARY KEY, b BOOLEAN)");
+            sql("INSERT INTO t VALUES (0, TRUE), (1, TRUE), (2, FALSE), (3, 
FALSE), (4, null)");
+            sql("CREATE INDEX t_idx ON t(b)");
+
+            assertQuery("SELECT i FROM t WHERE b = TRUE")
+                    .matches(containsIndexScan("PUBLIC", "T", "T_IDX"))
+                    .returns(0)
+                    .returns(1)
+                    .check();
+
+            assertQuery("SELECT i FROM t WHERE b = FALSE")
+                    .matches(containsIndexScan("PUBLIC", "T", "T_IDX"))
+                    .returns(2)
+                    .returns(3)
+                    .check();
+
+            assertQuery("SELECT i FROM t WHERE b IS TRUE")
+                    .matches(containsIndexScan("PUBLIC", "T", "T_IDX"))
+                    .returns(0)
+                    .returns(1)
+                    .check();
+
+            assertQuery("SELECT i FROM t WHERE b IS FALSE")
+                    .matches(containsIndexScan("PUBLIC", "T", "T_IDX"))
+                    .returns(2)
+                    .returns(3)
+                    .check();
+
+            // Support index scans for IS TRUE, IS FALSE but not for IS NOT 
TRUE, IS NOT FALSE,
+            // since it requires multi-bounds scan and may not be effective.

Review Comment:
   @lowka We can rewrite `a IS NOT TRUE` to `a = FALSE or a is NULL`. If I 
understand correctly, then this will require several index scans, which (at 
least for boolean) are less efficient than a single table scan :thinking:
   What is the bug here?



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to