You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "zstan (via GitHub)" <gi...@apache.org> on 2026/04/13 08:52:06 UTC

[PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

zstan opened a new pull request, #13011:
URL: https://github.com/apache/ignite/pull/13011

   plan from failed logs:
   ```
   IgniteIndexScan(table=[[PUBLIC, T1]], index=[IDX1], filters=[AND(**=($t1, 0), =($t0, 0)**, CASE(IS NULL($t2), null:BOOLEAN, OR(=(CAST($t2):INTEGER NOT NULL, 0), =(CAST($t2):INTEGER NOT NULL, 1), 
   =(CAST($t2):INTEGER NOT NULL, 2))))], requiredColumns=[{0, 1, 2}], searchBounds=[[ExactBounds [bound=0], null, null]], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 4341.09375, cumulative cost = IgniteCost [rowCount=75001.0, cpu=300040.3670901322, memory=1.0, io=1.0, network=1.0], id = 1244437
   ```
   
   plan from common master branch run:
   ```
   IgniteIndexScan(table=[[PUBLIC, T1]], index=[IDX1], filters=[AND(**=($t0, 0), =($t1, 0)**, CASE(IS NULL($t2), null:BOOLEAN, OR(=(CAST($t2):INTEGER NOT NULL, 0), =(CAST($t2):INTEGER NOT NULL, 1), 
   =(CAST($t2):INTEGER NOT NULL, 2))))], requiredColumns=[{0, 1, 2}], searchBounds=[[ExactBounds [bound=0], null, null]], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 4341.09375, cumulative cost = IgniteCost [rowCount=75001.0, cpu=300040.3670901322, memory=1.0, io=1.0, network=1.0], id = 429 
   ```


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #13011:
URL: https://github.com/apache/ignite/pull/13011#issuecomment-4280824515

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [2 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) (required ≤ 1)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011)
   
   ##   
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png '') Catch issues before they fail your Quality Gate with our IDE extension ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png '') [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
   
   


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #13011:
URL: https://github.com/apache/ignite/pull/13011#issuecomment-4313469405

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [2 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) (required ≤ 1)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011)
   
   ##   
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png '') Catch issues before they fail your Quality Gate with our IDE extension ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png '') [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
   
   


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #13011:
URL: https://github.com/apache/ignite/pull/13011#issuecomment-4332680865

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [2 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) (required ≤ 1)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011)
   
   ##   
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png '') Catch issues before they fail your Quality Gate with our IDE extension ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png '') [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
   
   


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #13011:
URL: https://github.com/apache/ignite/pull/13011#issuecomment-4280123756

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_ignite&pullRequest=13011&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_ignite&pullRequest=13011&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_ignite&pullRequest=13011&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_ignite&pullRequest=13011&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_ignite&pullRequest=13011&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011)
   
   


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #13011:
URL: https://github.com/apache/ignite/pull/13011#issuecomment-4281117855

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_ignite&pullRequest=13011&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_ignite&pullRequest=13011&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_ignite&pullRequest=13011&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_ignite&pullRequest=13011&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_ignite&pullRequest=13011&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011)
   
   


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #13011:
URL: https://github.com/apache/ignite/pull/13011#issuecomment-4235136317

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_ignite&pullRequest=13011&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_ignite&pullRequest=13011&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_ignite&pullRequest=13011&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_ignite&pullRequest=13011&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_ignite&pullRequest=13011&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011)
   
   


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on PR #13011:
URL: https://github.com/apache/ignite/pull/13011#issuecomment-4428558191

   plan from failed logs:
   ```
   IgniteIndexScan(table=[[PUBLIC, T1]], index=[IDX1], filters=[AND(=($t1, 0), =($t0, 0), CASE(IS NULL($t2), null:BOOLEAN, OR(=(CAST($t2):INTEGER NOT NULL, 0), =(CAST($t2):INTEGER NOT NULL, 1), 
   =(CAST($t2):INTEGER NOT NULL, 2))))], requiredColumns=[{0, 1, 2}], searchBounds=[[ExactBounds [bound=0], null, null]], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 4341.09375, cumulative cost = IgniteCost [rowCount=75001.0, cpu=300040.3670901322, memory=1.0, io=1.0, network=1.0], id = 1244437
   ```
   
   plan from common master branch run:
   ```
   IgniteIndexScan(table=[[PUBLIC, T1]], index=[IDX1], filters=[AND(=($t0, 0), =($t1, 0), CASE(IS NULL($t2), null:BOOLEAN, OR(=(CAST($t2):INTEGER NOT NULL, 0), =(CAST($t2):INTEGER NOT NULL, 1), 
   =(CAST($t2):INTEGER NOT NULL, 2))))], requiredColumns=[{0, 1, 2}], searchBounds=[[ExactBounds [bound=0], null, null]], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 4341.09375, cumulative cost = IgniteCost [rowCount=75001.0, cpu=300040.3670901322, memory=1.0, io=1.0, network=1.0], id = 429 
   ```
   
   here we can see that conditions are different: filters=[AND(**=($t1, 0),
   =($t0, 0)** vs filters=[AND(**=($t0, 0), =($t1, 0)**


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan merged PR #13011:
URL: https://github.com/apache/ignite/pull/13011


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #13011:
URL: https://github.com/apache/ignite/pull/13011#issuecomment-4279825836

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [3 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) (required ≤ 1)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011)
   
   ##   
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png '') Catch issues before they fail your Quality Gate with our IDE extension ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png '') [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
   
   


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "alex-plekhanov (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #13011:
URL: https://github.com/apache/ignite/pull/13011#issuecomment-4428507188

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_ignite&pullRequest=13011&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_ignite&pullRequest=13011&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_ignite&pullRequest=13011&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_ignite&pullRequest=13011&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_ignite&pullRequest=13011&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011)
   
   


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "alex-plekhanov (via GitHub)" <gi...@apache.org>.
alex-plekhanov commented on code in PR #13011:
URL: https://github.com/apache/ignite/pull/13011#discussion_r3080488411


##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerTest.java:
##########
@@ -619,6 +626,49 @@ protected <T extends RelNode> Predicate<RelNode> input(Predicate<T> predicate) {
         return input(0, predicate);
     }
 
+    /** Low level conditions analyzer. */
+    private static boolean validateIdxConditions(IgniteIndexScan node, SqlKind opKind, String... strConditions) {
+        /** */
+        Set<String> conditions = new HashSet<>();
+
+        /** */
+        RexShuttle shuttle = new RexShuttle() {
+            boolean firstCall = true;
+
+            @Override public RexNode visitCall(RexCall call) {
+                if (firstCall) {

Review Comment:
   If we check only first call, why do we need RexShuttle at all?
   It can be implemented much simplier by checking only root operator and operands.
   But It still will be too specialized and seems that can be used only by one test.
   Instead I propose to implement something like condition normalizator (I think it will be useful in future for other tests), it can be implemented for example this way:
   ```
       private static RexNode normalizeCondition(RexBuilder rexBuilder, RexNode condition) {
           return new RexShuttle() {
               @Override public RexNode visitCall(RexCall call) {
                   Pair<SqlOperator, List<RexNode>> normalized = RexNormalize.normalize(call.getOperator(), call.getOperands());
   
                   return rexBuilder.makeCall(normalized.getKey(), normalized.getValue());
               }
           }.apply(condition);
       }
   ``` 
   And to check condition we can do something like:
   ```
       protected <T extends RelNode> Predicate<ProjectableFilterableTableScan> satisfyCondition(String condition) {
           return node -> {
               String normCond = normalizeCondition(node.getCluster().getRexBuilder(), node.condition()).toString();
   
               if (!condition.equals(normCond)) {
                   lastErrorMsg = "Unexpected condition [expected=" + condition + ", actual=" + normCond + ']';
   
                   return false;
               }
   
               return true;
           };
       }
   ```
   In this case we can check normalized condition like:
   ```
   .and(satisfyCondition("AND(=($t0, 0), =($t1, 0), SEARCH($t2, Sarg[0, 1, 2]))")));
   ``` 



-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #13011:
URL: https://github.com/apache/ignite/pull/13011#issuecomment-4280038971

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [3 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011) (required ≤ 1)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13011)
   
   ##   
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png '') Catch issues before they fail your Quality Gate with our IDE extension ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png '') [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
   
   


-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #13011:
URL: https://github.com/apache/ignite/pull/13011#discussion_r3111005464


##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerTest.java:
##########
@@ -619,6 +626,49 @@ protected <T extends RelNode> Predicate<RelNode> input(Predicate<T> predicate) {
         return input(0, predicate);
     }
 
+    /** Low level conditions analyzer. */
+    private static boolean validateIdxConditions(IgniteIndexScan node, SqlKind opKind, String... strConditions) {
+        /** */
+        Set<String> conditions = new HashSet<>();
+
+        /** */
+        RexShuttle shuttle = new RexShuttle() {
+            boolean firstCall = true;
+
+            @Override public RexNode visitCall(RexCall call) {
+                if (firstCall) {

Review Comment:
   @alex-plekhanov with using Shuttle i believe code a bit readable than flat one, but if you insist i will fix it.
   Other part is refactored. 



-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #13011:
URL: https://github.com/apache/ignite/pull/13011#discussion_r3111005464


##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerTest.java:
##########
@@ -619,6 +626,49 @@ protected <T extends RelNode> Predicate<RelNode> input(Predicate<T> predicate) {
         return input(0, predicate);
     }
 
+    /** Low level conditions analyzer. */
+    private static boolean validateIdxConditions(IgniteIndexScan node, SqlKind opKind, String... strConditions) {
+        /** */
+        Set<String> conditions = new HashSet<>();
+
+        /** */
+        RexShuttle shuttle = new RexShuttle() {
+            boolean firstCall = true;
+
+            @Override public RexNode visitCall(RexCall call) {
+                if (firstCall) {

Review Comment:
   @alex-plekhanov with using Shuttle i believe code a bit readable that flat one, but if you insist i will fix it.
   Other part is refactored. 



-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #13011:
URL: https://github.com/apache/ignite/pull/13011#discussion_r3137879272


##########
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:
   @alex-plekhanov thanks, let`s use your approach



-- 
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-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-28526 Fix flaky RexSimplificationPlannerTest.testExtractCommonDisjunctionPart [ignite]

Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #13011:
URL: https://github.com/apache/ignite/pull/13011#discussion_r3101791702


##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerTest.java:
##########
@@ -619,6 +626,49 @@ protected <T extends RelNode> Predicate<RelNode> input(Predicate<T> predicate) {
         return input(0, predicate);
     }
 
+    /** Low level conditions analyzer. */
+    private static boolean validateIdxConditions(IgniteIndexScan node, SqlKind opKind, String... strConditions) {
+        /** */
+        Set<String> conditions = new HashSet<>();
+
+        /** */
+        RexShuttle shuttle = new RexShuttle() {
+            boolean firstCall = true;
+
+            @Override public RexNode visitCall(RexCall call) {
+                if (firstCall) {

Review Comment:
   but ... it doesn`t work as expected ( 
   
   ```
               RexBuilder builder = node.getCluster().getRexBuilder();
               RexLiteral l0 = builder.makeExactLiteral(new BigDecimal(0));
               RexLocalRef lr0 = new RexLocalRef(0, node.getCluster().getTypeFactory().createJavaType(long.class));
   
               RexLiteral l1 = builder.makeExactLiteral(new BigDecimal(0));
               RexLocalRef lr1 = new RexLocalRef(1, node.getCluster().getTypeFactory().createJavaType(long.class));
   
               final RangeSet<Integer> setNone = ImmutableRangeSet.of();
               final RangeSet<Integer> setAll = setNone.complement();
               final Sarg<Integer> sarg =
                   Sarg.of(RexUnknownAs.FALSE, setAll);
               RexNode intLiteral =
                   builder.makeLiteral(1, node.getCluster().getTypeFactory().createSqlType(SqlTypeName.INTEGER));
               RexNode rexNode =
                   builder.makeCall(SqlStdOperatorTable.SEARCH, intLiteral,
                       builder.makeSearchArgumentLiteral(sarg, intLiteral.getType()));
               RexLocalRef lr2 = new RexLocalRef(2, node.getCluster().getTypeFactory().createJavaType(long.class));
   
               RexNode r0 = builder.makeCall(SqlStdOperatorTable.EQUALS, lr0, l0);
               RexNode r1 = builder.makeCall(SqlStdOperatorTable.EQUALS, lr1, l1);
               RexNode r3 = builder.makeCall(SqlStdOperatorTable.EQUALS, lr2, rexNode);
   
               RexNode res = builder.makeCall(SqlStdOperatorTable.AND, r1, r0, r3);
               String norm = normalizeExpression(node.getCluster().getRexBuilder(), res).toString();
   
               System.err.println("node >>: " + res);
               System.err.println("norm >>: " + norm);
   ```
   
   returns:
   
   ```
   node >>: AND(=($t1, 0), =($t0, 0), =($t2, SEARCH(1, Sarg[IS NOT NULL])))
   norm >>: AND(=($t1, 0), =($t0, 0), =($t2, SEARCH(1, Sarg[IS NOT NULL])))
   ```



-- 
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-unsubscribe@ignite.apache.org

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