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


##########
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:
   You are correct there is no problem when `b` is not nullable. and WHERE b = 
true and WHERE b is not false be have the same way in that case.



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