korlov42 commented on code in PR #2282: URL: https://github.com/apache/ignite-3/pull/2282#discussion_r1260714547
########## modules/binary-tuple/src/main/java/org/apache/ignite/internal/binarytuple/BinaryTupleReader.java: ########## @@ -79,6 +79,34 @@ public boolean hasNullValue(int index) { return begin == end; } + /** + * Reads value of specified element. + * + * @param index Element index. + * @return Element value. + */ + public boolean booleanValue(int index) { Review Comment: why don't you have unit test for binary tuple? ########## modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/RexUtils.java: ########## @@ -685,6 +688,18 @@ private static RexNode invert(RexBuilder rexBuilder, RexCall call) { } } + private static RexNode expandBooleanFieldComparison(RexNode rexNode, RexBuilder builder) { Review Comment: it would be nice to have javadoc for this method ########## 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: > several index scans, which (at least for boolean) seems less efficient than a single table scan why do you think so? -- 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