alex-plekhanov commented on code in PR #13011:
URL: https://github.com/apache/ignite/pull/13011#discussion_r3131404472


##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerTest.java:
##########
@@ -619,6 +627,80 @@ protected <T extends RelNode> Predicate<RelNode> 
input(Predicate<T> predicate) {
         return input(0, predicate);
     }
 
+    /**
+     * Change localRef arrangement according lexographical ordering, i.e. <br>
+     * AND(=($t1, 0), =($t0, 0), SEARCH($t2, Sarg[IS NOT NULL])) <br>
+     * will become: <br>
+     * AND(=($t0, 0), =($t1, 0), SEARCH($t2, Sarg[IS NOT NULL]))
+     */
+    protected <T extends RelNode> Predicate<ProjectableFilterableTableScan> 
satisfyCondition(String condition) {

Review Comment:
   Why not just sort operands by their toString representaion? It's much 
simplier and more universal. Something like:
   ```
       protected <T extends RelNode> Predicate<ProjectableFilterableTableScan> 
satisfyCondition(String condition) {
           return node -> {
               RexShuttle shuttle = new RexShuttle() {
                   @Override public RexNode visitCall(RexCall call) {
                       RexCall call0 = (RexCall)super.visitCall(call);
   
                       if (call0.getOperator().isSymmetrical()) {
                           List<RexNode> exprs = new 
ArrayList<>(call0.getOperands());
                           exprs.sort(Comparator.comparing(RexNode::toString));
                           return 
node.getCluster().getRexBuilder().makeCall(call0.getOperator(), exprs);
                       }
   
                       return call0;
                   }
               };
   
               RexNode normCond = shuttle.apply(node.condition());
   
               if (!condition.equals(normCond.toString())) {
                   lastErrorMsg = "Unexpected condition [expected=" + condition 
+ ", actual=" + normCond + ']';
   
                   return false;
               }
   
               return true;
           };
       }
   ```



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