You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/12/21 15:46:38 UTC

[GitHub] [ignite] zstan opened a new pull request #9681: IGNITE-16138 Calcite. AssertionError: Input not sorted

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


   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


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



[GitHub] [ignite] alex-plekhanov commented on a change in pull request #9681: IGNITE-16138 Calcite. AssertionError: Input not sorted

Posted by GitBox <gi...@apache.org>.
alex-plekhanov commented on a change in pull request #9681:
URL: https://github.com/apache/ignite/pull/9681#discussion_r775490682



##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SortAggregateIntegrationTest.java
##########
@@ -27,41 +27,39 @@
 import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.cache.QueryIndexType;
 import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.cache.query.FieldsQueryCursor;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.query.QueryEngine;
-import org.apache.ignite.internal.processors.query.calcite.util.Commons;
-import org.apache.ignite.internal.util.typedef.X;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Test;
 
-import static java.util.Collections.singletonList;
-
 /**
  * Sort aggregate integration test.
  */
-public class SortAggregateIntegrationTest extends GridCommonAbstractTest {
+public class SortAggregateIntegrationTest extends AbstractBasicIntegrationTest {
     /** */
     public static final int ROWS = 103;
 
+    /** */
+    @Override protected int nodeCount() {
+        return 2;
+    }
+
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {

Review comment:
       Method is redundant

##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SortAggregateIntegrationTest.java
##########
@@ -184,18 +154,9 @@ private void fillCacheTest(IgniteCache c, int rows) throws InterruptedException
         /** */
         int col1;
 
-        /** */
-        int col2;
-
-        /** */
-        int col3;
-
-        /** */
-        int col4;
-
         /** */
         TestValTbl1(int k) {
-            col0 = col1 = col2 = col3 = col4 = k;
+            col0 = col1 = k;

Review comment:
       `col1` is redundant too




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



[GitHub] [ignite] alex-plekhanov commented on a change in pull request #9681: IGNITE-16138 Calcite. AssertionError: Input not sorted

Posted by GitBox <gi...@apache.org>.
alex-plekhanov commented on a change in pull request #9681:
URL: https://github.com/apache/ignite/pull/9681#discussion_r773671889



##########
File path: modules/calcite/src/test/java/org/apache/ignite/testsuites/ScriptTestSuite.java
##########
@@ -74,6 +74,5 @@
  */
 @RunWith(ScriptTestRunner.class)
 @ScriptRunnerTestsEnvironment(scriptsRoot = "src/test/sql/", timeout = 180000)
-@Ignore

Review comment:
       Import should be removed too




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



[GitHub] [ignite] alex-plekhanov commented on a change in pull request #9681: IGNITE-16138 Calcite. AssertionError: Input not sorted

Posted by GitBox <gi...@apache.org>.
alex-plekhanov commented on a change in pull request #9681:
URL: https://github.com/apache/ignite/pull/9681#discussion_r773691905



##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SortAggregateIntegrationTest.java
##########
@@ -114,21 +127,80 @@ public void mapReduceAggregate() {
         });
     }
 
+    /** */
+    @Test
+    public void correctCollationsOnMapReduceSortAgg() throws InterruptedException {
+        fillCacheTbl1(grid(0).cache("TEST"), ROWS);
+
+        QueryEngine engine = Commons.lookupComponent(grid(0).context(), QueryEngine.class);

Review comment:
       Perhaps it's better to extend AbstractBasicIntegrationTest to get rid of boilerplate code

##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SortAggregateIntegrationTest.java
##########
@@ -114,21 +127,80 @@ public void mapReduceAggregate() {
         });
     }
 
+    /** */
+    @Test
+    public void correctCollationsOnMapReduceSortAgg() throws InterruptedException {
+        fillCacheTbl1(grid(0).cache("TEST"), ROWS);
+
+        QueryEngine engine = Commons.lookupComponent(grid(0).context(), QueryEngine.class);
+
+        List<FieldsQueryCursor<List<?>>> cursors = engine.query(
+            null,
+            "PUBLIC",
+            "SELECT /*+ DISABLE_RULE('HashAggregateConverterRule' ,'HashSingleAggregateConverterRule', " +

Review comment:
       Too complicated query. To reproduce the problem it's enough just two columns in the table (PK, COL0) and descending index by COL0, with this query: `SELECT PK FROM TBL1 WHERE col0 IN (SELECT col0 FROM TBL1)`




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



[GitHub] [ignite] zstan closed pull request #9681: IGNITE-16138 Calcite. AssertionError: Input not sorted

Posted by GitBox <gi...@apache.org>.
zstan closed pull request #9681:
URL: https://github.com/apache/ignite/pull/9681


   


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



[GitHub] [ignite] alex-plekhanov commented on a change in pull request #9681: IGNITE-16138 Calcite. AssertionError: Input not sorted

Posted by GitBox <gi...@apache.org>.
alex-plekhanov commented on a change in pull request #9681:
URL: https://github.com/apache/ignite/pull/9681#discussion_r773672354



##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SortAggregateIntegrationTest.java
##########
@@ -19,6 +19,7 @@
 
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.LinkedHashMap;

Review comment:
       Check for unused imports




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



[GitHub] [ignite] zstan closed pull request #9681: IGNITE-16138 Calcite. AssertionError: Input not sorted

Posted by GitBox <gi...@apache.org>.
zstan closed pull request #9681:
URL: https://github.com/apache/ignite/pull/9681


   


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



[GitHub] [ignite] alex-plekhanov commented on a change in pull request #9681: IGNITE-16138 Calcite. AssertionError: Input not sorted

Posted by GitBox <gi...@apache.org>.
alex-plekhanov commented on a change in pull request #9681:
URL: https://github.com/apache/ignite/pull/9681#discussion_r773663551



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Inbox.java
##########
@@ -203,30 +203,38 @@ private void push() throws Exception {
             pushUnordered();
     }
 
-    /** */
-    private void pushOrdered() throws Exception {
-         PriorityQueue<Pair<Row, Buffer>> heap =
-            new PriorityQueue<>(Math.max(buffers.size(), 1), Map.Entry.comparingByKey(comp));
-
-        Iterator<Buffer> it = buffers.iterator();
-
+    /** Checks that all corresponding buffers are in ready state. */
+    private boolean checkAllBuffsReady(Iterator<Buffer> it) {
         while (it.hasNext()) {
             Buffer buf = it.next();
 
             switch (buf.check()) {
+                case READY:
+                    break;
                 case END:
                     it.remove();
-
-                    break;
-                case READY:
-                    heap.offer(Pair.of(buf.peek(), buf));
-
                     break;
                 case WAITING:
-
-                    return;
+                    return false;
             }
         }
+        return true;
+    }
+
+    /** */
+    private void pushOrdered() throws Exception {
+        if (!checkAllBuffsReady(buffers.iterator()))
+            return;
+
+        PriorityQueue<Pair<Row, Buffer>> heap =
+            new PriorityQueue<>(Math.max(buffers.size(), 1), Map.Entry.comparingByKey(comp));
+
+        for (Buffer buf : buffers) {
+            if (buf.check() == State.READY)

Review comment:
       Maybe just `assert buf.check() == State.READY : "Unexpected buffer state: " + buf.check();`?
   `buf.check()` - is not a simple getter, with current syntax it will be executed even if assertions are disabled.

##########
File path: modules/calcite/src/test/sql/sqlite/orderby/orderby1_10_2.test_ignore
##########
@@ -2070,10 +2069,6 @@ SELECT pk, col0 FROM tab4 WHERE col3 > 808 OR col0 IS NULL ORDER BY 1,2
 725
 8
 
-query I valuesort label-1200
-SELECT pk FROM tab0 WHERE (col3 < 204) AND col3 IN (SELECT col0 FROM tab0 WHERE col3 >= 218) AND col4 IN (SELECT col1 FROM tab0 WHERE (((((col3 IN (427) OR col3 <= 404)))) OR ((col0 IS NULL AND (col4 > 802.10 AND col0 = 651))) OR col3 BETWEEN 851 AND 573)) ORDER BY 1 DESC
-----
-

Review comment:
       Why this query was deleted?




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



[GitHub] [ignite] zstan commented on a change in pull request #9681: IGNITE-16138 Calcite. AssertionError: Input not sorted

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9681:
URL: https://github.com/apache/ignite/pull/9681#discussion_r775353820



##########
File path: modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/SortAggregateIntegrationTest.java
##########
@@ -19,6 +19,7 @@
 
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.LinkedHashMap;

Review comment:
       this import is used.




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