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


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/exp/ExpressionFactoryImplTest.java:
##########
@@ -311,6 +312,232 @@ void multiBoundConditionAreOrderedCorrectly() {
         }
     }
 
+    @Test
+    void multiBoundConditionsAreMergedCorrectly() {
+        RexBuilder rexBuilder = Commons.rexBuilder();
+
+        // condition expression is not used
+        RexLiteral condition = rexBuilder.makeLiteral(true);
+
+        RelDataType rowType = new Builder(typeFactory)
+                .add("C1", SqlTypeName.INTEGER)
+                .build();
+
+        RexNode intValue1 = rexBuilder.makeExactLiteral(new BigDecimal("1"));
+        RexNode intValue2 = rexBuilder.makeExactLiteral(new BigDecimal("2"));
+        RexNode intValue3 = rexBuilder.makeExactLiteral(new BigDecimal("3"));
+        RexNode intValue5 = rexBuilder.makeExactLiteral(new BigDecimal("5"));
+
+        { // conditions 'val < 1 or val = 1 or val = 5' can be combined to 
'val <= 1 or val = 5' (ASCENDING)
+            List<SearchBounds> boundsList = List.of(
+                    new MultiBounds(condition, List.of(
+                            new ExactBounds(condition, intValue5),
+                            new ExactBounds(condition, intValue1),
+                            new RangeBounds(condition, null, intValue1, true, 
false)
+                    ))
+            );
+
+            Comparator<Object[]> comparator = 
expFactory.comparator(RelCollations.of(
+                    new RelFieldCollation(0, Direction.ASCENDING)));
+
+            RangeIterable<Object[]> ranges = expFactory.ranges(boundsList, 
rowType, comparator);
+            List<TestRange> list = new ArrayList<>();

Review Comment:
   I think collecting a list of ranges from a range iterable could be extracted 
into a separate method to improve readability of these test cases.



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

Reply via email to