[ 
https://issues.apache.org/jira/browse/IGNITE-25658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Evgeny Stanilovsky updated IGNITE-25658:
----------------------------------------
    Ignite Flags:   (was: Docs Required,Release Notes Required)

> Sql. Cannot cancel a query fragment with a sequence of NestedLoopJoin 
> operators
> -------------------------------------------------------------------------------
>
>                 Key: IGNITE-25658
>                 URL: https://issues.apache.org/jira/browse/IGNITE-25658
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql ai3
>            Reporter: Maksim Zhuravkov
>            Assignee: Evgeny Stanilovsky
>            Priority: Major
>              Labels: ignite-3
>
> This query demonstrates that a sequence of NestedLoopJoin operators does not 
> preempt itself, thus preventing the SQL engine from cancelling a query:
> {noformat}
> @Test
>     public void cancelStatement2() throws InterruptedException {
>         IgniteSql sql = igniteSql();
>         sql.executeScript("CREATE TABLE TEST(ID INT PRIMARY KEY, VAL INT)");
>         for (int i = 0; i < 10; i++) {
>             sql.executeScript("INSERT INTO TEST VALUES (?, ?)", i, i);
>         }
>         var crossJoin10x = "SELECT count(*) FROM ("
>                 + "SELECT "
>                 + "t1.ID AS ID1, t2.ID AS ID2, t3.ID AS ID3, t4.ID AS ID4, 
> t5.ID AS ID5, "
>                 + "t6.ID AS ID6, t7.ID AS ID7, t8.ID AS ID8, t9.ID AS ID9, 
> t10.ID AS ID10 "
>                 + "FROM TEST t1 "
>                 + "CROSS JOIN TEST t2 "
>                 + "CROSS JOIN TEST t3 "
>                 + "CROSS JOIN TEST t4 "
>                 + "CROSS JOIN TEST t5 "
>                 + "CROSS JOIN TEST t6 "
>                 + "CROSS JOIN TEST t7 "
>                 + "CROSS JOIN TEST t8 "
>                 + "CROSS JOIN TEST t9 "
>                 + "CROSS JOIN TEST t10"
>                 + ")";
>         {
>             ResultSet<SqlRow> rs = sql.execute(null, "EXPLAIN PLAN FOR " + 
> crossJoin10x);
>             System.err.println(rs.next().stringValue(0));
>             rs.close();
>         }
>         {
>             Statement statement = sql.statementBuilder()
>                     .query(crossJoin10x)
>                     .build();
>             CancelHandle cancelHandle = CancelHandle.create();
>             CompletableFuture<AsyncResultSet<SqlRow>> fut = 
> sql.executeAsync(null, cancelHandle.token(), statement);
>             Thread.sleep(2000);
>             cancelHandle.cancel();
>             fut.join();
>         }
>     }
> {noformat}
> Plan:
> {noformat}
> ColocatedHashAggregate
>     fieldNames: [EXPR$0]
>     group: []
>     aggregation: [COUNT()]
>     est: (rows=1)
>   Project
>       fieldNames: [DUMMY7, DUMMY1, DUMMY3, DUMMY5, DUMMY8, DUMMY6, DUMMY, 
> DUMMY0, DUMMY2, DUMMY4]
>       projection: [DUMMY7, DUMMY1, DUMMY3, DUMMY5, DUMMY8, DUMMY6, DUMMY, 
> DUMMY0, DUMMY2, DUMMY4]
>       est: (rows=1)
>     NestedLoopJoin
>         predicate: true
>         fieldNames: [DUMMY, DUMMY0, DUMMY1, DUMMY2, DUMMY3, DUMMY4, DUMMY5, 
> DUMMY6, DUMMY7, DUMMY8]
>         type: inner
>         est: (rows=1)
>       NestedLoopJoin
>           predicate: true
>           fieldNames: [DUMMY, DUMMY0, DUMMY1, DUMMY2, DUMMY3, DUMMY4, DUMMY5, 
> DUMMY6, DUMMY7]
>           type: inner
>           est: (rows=1)
>         NestedLoopJoin
>             predicate: true
>             fieldNames: [DUMMY, DUMMY0, DUMMY1, DUMMY2, DUMMY3, DUMMY4, 
> DUMMY5, DUMMY6]
>             type: inner
>             est: (rows=1)
>           NestedLoopJoin
>               predicate: true
>               fieldNames: [DUMMY, DUMMY0, DUMMY1, DUMMY2, DUMMY3, DUMMY4, 
> DUMMY5]
>               type: inner
>               est: (rows=1)
>             NestedLoopJoin
>                 predicate: true
>                 fieldNames: [DUMMY, DUMMY0, DUMMY1, DUMMY2, DUMMY3, DUMMY4]
>                 type: inner
>                 est: (rows=1)
>               NestedLoopJoin
>                   predicate: true
>                   fieldNames: [DUMMY, DUMMY0, DUMMY1, DUMMY2, DUMMY3]
>                   type: inner
>                   est: (rows=1)
>                 NestedLoopJoin
>                     predicate: true
>                     fieldNames: [DUMMY, DUMMY0, DUMMY1, DUMMY2]
>                     type: inner
>                     est: (rows=1)
>                   NestedLoopJoin
>                       predicate: true
>                       fieldNames: [DUMMY, DUMMY0, DUMMY1]
>                       type: inner
>                       est: (rows=1)
>                     NestedLoopJoin
>                         predicate: true
>                         fieldNames: [DUMMY, DUMMY0]
>                         type: inner
>                         est: (rows=1)
>                       Exchange
>                           distribution: single
>                           est: (rows=1)
>                         TableScan
>                             table: PUBLIC.TEST
>                             fieldNames: [DUMMY]
>                             projection: [0]
>                             est: (rows=1)
>                       Exchange
>                           distribution: single
>                           est: (rows=1)
>                         TableScan
>                             table: PUBLIC.TEST
>                             fieldNames: [DUMMY]
>                             projection: [0]
>                             est: (rows=1)
>                     Exchange
>                         distribution: single
>                         est: (rows=1)
>                       TableScan
>                           table: PUBLIC.TEST
>                           fieldNames: [DUMMY]
>                           projection: [0]
>                           est: (rows=1)
>                   Exchange
>                       distribution: single
>                       est: (rows=1)
>                     TableScan
>                         table: PUBLIC.TEST
>                         fieldNames: [DUMMY]
>                         projection: [0]
>                         est: (rows=1)
>                 Exchange
>                     distribution: single
>                     est: (rows=1)
>                   TableScan
>                       table: PUBLIC.TEST
>                       fieldNames: [DUMMY]
>                       projection: [0]
>                       est: (rows=1)
>               Exchange
>                   distribution: single
>                   est: (rows=1)
>                 TableScan
>                     table: PUBLIC.TEST
>                     fieldNames: [DUMMY]
>                     projection: [0]
>                     est: (rows=1)
>             Exchange
>                 distribution: single
>                 est: (rows=1)
>               TableScan
>                   table: PUBLIC.TEST
>                   fieldNames: [DUMMY]
>                   projection: [0]
>                   est: (rows=1)
>           Exchange
>               distribution: single
>               est: (rows=1)
>             TableScan
>                 table: PUBLIC.TEST
>                 fieldNames: [DUMMY]
>                 projection: [0]
>                 est: (rows=1)
>         Exchange
>             distribution: single
>             est: (rows=1)
>           TableScan
>               table: PUBLIC.TEST
>               fieldNames: [DUMMY]
>               projection: [0]
>               est: (rows=1)
>       Exchange
>           distribution: single
>           est: (rows=1)
>         TableScan
>             table: PUBLIC.TEST
>             fieldNames: [DUMMY]
>             projection: [0]
>             est: (rows=1)
> {noformat}
> Thread dump:
> {noformat}
> at SC.project(Unknown Source)
>       at 
> org.apache.ignite.internal.sql.engine.exec.exp.JoinProjectionImplementor$SqlJoinProjectionImpl.project(JoinProjectionImplementor.java:176)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.join(NestedLoopJoinNode.java:217)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode.pushLeft(AbstractRightMaterializedJoinNode.java:129)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.pushLeft(NestedLoopJoinNode.java:190)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode$1.push(AbstractRightMaterializedJoinNode.java:73)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.join(NestedLoopJoinNode.java:218)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode.pushLeft(AbstractRightMaterializedJoinNode.java:129)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.pushLeft(NestedLoopJoinNode.java:190)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode$1.push(AbstractRightMaterializedJoinNode.java:73)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.join(NestedLoopJoinNode.java:218)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode.pushLeft(AbstractRightMaterializedJoinNode.java:129)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.pushLeft(NestedLoopJoinNode.java:190)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode$1.push(AbstractRightMaterializedJoinNode.java:73)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.join(NestedLoopJoinNode.java:218)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode.pushLeft(AbstractRightMaterializedJoinNode.java:129)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.pushLeft(NestedLoopJoinNode.java:190)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode$1.push(AbstractRightMaterializedJoinNode.java:73)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.join(NestedLoopJoinNode.java:218)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode.pushLeft(AbstractRightMaterializedJoinNode.java:129)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.pushLeft(NestedLoopJoinNode.java:190)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode$1.push(AbstractRightMaterializedJoinNode.java:73)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.join(NestedLoopJoinNode.java:218)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode.pushLeft(AbstractRightMaterializedJoinNode.java:129)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.pushLeft(NestedLoopJoinNode.java:190)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode$1.push(AbstractRightMaterializedJoinNode.java:73)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.join(NestedLoopJoinNode.java:218)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode.pushLeft(AbstractRightMaterializedJoinNode.java:129)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.pushLeft(NestedLoopJoinNode.java:190)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode$1.push(AbstractRightMaterializedJoinNode.java:73)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.join(NestedLoopJoinNode.java:218)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode.pushLeft(AbstractRightMaterializedJoinNode.java:129)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.pushLeft(NestedLoopJoinNode.java:190)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode$1.push(AbstractRightMaterializedJoinNode.java:73)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.join(NestedLoopJoinNode.java:218)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode.pushLeft(AbstractRightMaterializedJoinNode.java:129)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.NestedLoopJoinNode$InnerJoin.pushLeft(NestedLoopJoinNode.java:190)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.AbstractRightMaterializedJoinNode$1.push(AbstractRightMaterializedJoinNode.java:73)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.Inbox.pushUnordered(Inbox.java:337)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.Inbox.push(Inbox.java:220)
>       at 
> org.apache.ignite.internal.sql.engine.exec.rel.Inbox.onBatchReceived(Inbox.java:204)
>       at 
> org.apache.ignite.internal.sql.engine.exec.ExchangeServiceImpl.onMessage(ExchangeServiceImpl.java:178)
>       at 
> org.apache.ignite.internal.sql.engine.exec.ExchangeServiceImpl.lambda$start$1(ExchangeServiceImpl.java:78)
>       at 
> org.apache.ignite.internal.sql.engine.exec.ExchangeServiceImpl$$Lambda$2785/0x0000000800da5440.onMessage(Unknown
>  Source)
>       at 
> org.apache.ignite.internal.sql.engine.message.MessageServiceImpl.onMessageInternal(MessageServiceImpl.java:171)
>       at 
> org.apache.ignite.internal.sql.engine.message.MessageServiceImpl.lambda$onMessage$1(MessageServiceImpl.java:135)
>       at 
> org.apache.ignite.internal.sql.engine.message.MessageServiceImpl$$Lambda$3989/0x00000008010f7040.run(Unknown
>  Source)
>       at 
> org.apache.ignite.internal.sql.engine.exec.QueryTaskExecutorImpl.lambda$execute$0(QueryTaskExecutorImpl.java:86)
>       at 
> org.apache.ignite.internal.sql.engine.exec.QueryTaskExecutorImpl$$Lambda$3014/0x0000000800e36840.run(Unknown
>  Source)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker([email protected]/ThreadPoolExecutor.java:1128)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run([email protected]/ThreadPoolExecutor.java:628)
>       at java.lang.Thread.run([email protected]/Thread.java:829)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to