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

Sergey Korotkov resolved IGNITE-24731.
--------------------------------------
    Fix Version/s: 2.18
       Resolution: Fixed

> Calcite. TPC-H query #2: failed to plan query
> ---------------------------------------------
>
>                 Key: IGNITE-24731
>                 URL: https://issues.apache.org/jira/browse/IGNITE-24731
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Sergey Korotkov
>            Assignee: Sergey Korotkov
>            Priority: Major
>              Labels: ise, tpch
>             Fix For: 2.18
>
>
> Error during planning: There are not enough rules to produce a node with 
> desired properties
> org.apache.calcite.plan.RelOptPlanner$CannotPlanException: There are not 
> enough rules to produce a node with desired properties: convention=IGNITE, 
> sort=[0 DESC-nulls-last, 2 ASC-nulls-first, 1 ASC-nulls-first, 3 
> ASC-nulls-first], distr=single, rewindability=one-way, 
> correlation=uncorrelated.
> Missing conversions are LogicalJoin[convention: NONE -> IGNITE, distr: any -> 
> single], LogicalFilter[convention: NONE -> IGNITE, sort: [] -> [1], distr: 
> any -> single, rewindability: one-way -> rewindable], 
> LogicalFilter[convention: NONE -> IGNITE, sort: [] -> [1]], 
> LogicalFilter[convention: NONE -> IGNITE, sort: [] -> [1], distr: any -> 
> single]
> {noformat}
> [2025-03-10T14:58:54,435][ERROR][main][] Test failed 
> [test=TpchTest#testQ[Query engine=calcite], duration=41401]
>  org.apache.ignite.internal.processors.query.IgniteSQLException: Failed to 
> plan query
>       at 
> org.apache.ignite.internal.processors.query.calcite.prepare.PrepareServiceImpl.prepareSingle(PrepareServiceImpl.java:117)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.lambda$parseAndProcessQuery$5(CalciteQueryProcessor.java:553)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.calcite.prepare.QueryPlanCacheImpl.lambda$queryPlan$0(QueryPlanCacheImpl.java:70)
>  ~[classes/:?]
>       at 
> java.base/java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:330)
>  ~[?:?]
>       at 
> org.apache.ignite.internal.processors.query.calcite.prepare.QueryPlanCacheImpl.queryPlan(QueryPlanCacheImpl.java:70)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.lambda$parseAndProcessQuery$6(CalciteQueryProcessor.java:550)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.processQuery(CalciteQueryProcessor.java:701)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.parseAndProcessQuery(CalciteQueryProcessor.java:547)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.query(CalciteQueryProcessor.java:420)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor$2.applyx(GridQueryProcessor.java:3119)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor$2.applyx(GridQueryProcessor.java:3075)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:3861)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$3(GridQueryProcessor.java:3152)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:3289)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:3071)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2995)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2968)
>  ~[classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchTest.exec(TpchTest.java:89)
>  ~[test-classes/:?]
>       at 
> org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchTest.testQ(TpchTest.java:79)
>  ~[test-classes/:?]
>       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method) ~[?:?]
>       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>  ~[?:?]
>       at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:?]
>       at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
>       at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>  ~[junit-4.12.jar:4.12]
>       at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>  ~[junit-4.12.jar:4.12]
>       at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>  ~[junit-4.12.jar:4.12]
>       at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>  ~[junit-4.12.jar:4.12]
>       at 
> org.apache.ignite.testframework.junits.GridAbstractTest$6.run(GridAbstractTest.java:2507)
>  ~[test-classes/:?]
>       at java.base/java.lang.Thread.run(Thread.java:829) ~[?:?]
>       Suppressed: org.apache.calcite.plan.RelOptPlanner$CannotPlanException: 
> There are not enough rules to produce a node with desired properties: 
> convention=IGNITE, sort=[0 DESC-nulls-last, 2 ASC-nulls-first, 1 
> ASC-nulls-first, 3 ASC-nulls-first], distr=single, rewindability=one-way, 
> correlation=uncorrelated.
> Missing conversions are LogicalJoin[convention: NONE -> IGNITE, distr: any -> 
> single], LogicalFilter[convention: NONE -> IGNITE, sort: [] -> [1], distr: 
> any -> single, rewindability: one-way -> rewindable], 
> LogicalFilter[convention: NONE -> IGNITE, sort: [] -> [1]], 
> LogicalFilter[convention: NONE -> IGNITE, sort: [] -> [1], distr: any -> 
> single]
> There are 4 empty subsets:
> Empty subset 0: rel#1993:RelSubset#16.IGNITE.[].single.one-way.uncorrelated, 
> the relevant part of the original plan is as follows
> 270:LogicalJoin(condition=[=($6, $7)], joinType=[inner])
>   
> 267:LogicalJoin(subset=[rel#268:RelSubset#14.NONE.[].any.one-way.uncorrelated],
>  condition=[=($4, $5)], joinType=[inner])
>     
> 264:LogicalJoin(subset=[rel#265:RelSubset#12.NONE.[].any.one-way.uncorrelated],
>  condition=[=($3, $1)], joinType=[inner])
>       
> 261:LogicalFilter(subset=[rel#262:RelSubset#10.NONE.[].any.one-way.uncorrelated],
>  condition=[=($cor0.P_PARTKEY, $0)])
>         
> 232:IgniteLogicalTableScan(subset=[rel#260:RelSubset#9.NONE.[].any.one-way.uncorrelated],
>  table=[[PUBLIC, PARTSUPP]], requiredColumns=[{2, 3, 5}])
>       
> 234:IgniteLogicalTableScan(subset=[rel#263:RelSubset#11.NONE.[].any.one-way.uncorrelated],
>  table=[[PUBLIC, SUPPLIER]], requiredColumns=[{2, 5}])
>     
> 236:IgniteLogicalTableScan(subset=[rel#266:RelSubset#13.NONE.[].any.one-way.uncorrelated],
>  table=[[PUBLIC, NATION]], requiredColumns=[{2, 4}])
>   
> 238:IgniteLogicalTableScan(subset=[rel#269:RelSubset#15.NONE.[].any.one-way.uncorrelated],
>  table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'EUROPE')], 
> requiredColumns=[{2, 3}])
> Empty subset 1: 
> rel#760560:RelSubset#10.IGNITE.[1].single.rewindable.correlated[$cor0], the 
> relevant part of the original plan is as follows
> 261:LogicalFilter(condition=[=($cor0.P_PARTKEY, $0)])
>   
> 232:IgniteLogicalTableScan(subset=[rel#260:RelSubset#9.NONE.[].any.one-way.uncorrelated],
>  table=[[PUBLIC, PARTSUPP]], requiredColumns=[{2, 3, 5}])
> Empty subset 2: rel#2035:RelSubset#10.IGNITE.[1].any.one-way.uncorrelated, 
> the relevant part of the original plan is as follows
> 261:LogicalFilter(condition=[=($cor0.P_PARTKEY, $0)])
>   
> 232:IgniteLogicalTableScan(subset=[rel#260:RelSubset#9.NONE.[].any.one-way.uncorrelated],
>  table=[[PUBLIC, PARTSUPP]], requiredColumns=[{2, 3, 5}])
> Empty subset 3: rel#2040:RelSubset#10.IGNITE.[1].single.one-way.uncorrelated, 
> the relevant part of the original plan is as follows
> 261:LogicalFilter(condition=[=($cor0.P_PARTKEY, $0)])
>   
> 232:IgniteLogicalTableScan(subset=[rel#260:RelSubset#9.NONE.[].any.one-way.uncorrelated],
>  table=[[PUBLIC, PARTSUPP]], requiredColumns=[{2, 3, 5}])
> {noformat}
> Reproducer:
> {code:java}
> package org.apache.ignite.internal.processors.query.calcite.integration.tpch;
> import 
> org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTest;
> import org.junit.Ignore;
> import org.junit.Test;
> public class TpchQ2Test extends AbstractBasicIntegrationTest {
>     /**
>      * Test the Q2 TPC-H query can be planned and executed.
>      */
>     @Test
>     public void testQ2() throws Exception {
>         TpchHelper.createTables(client);
>         TpchHelper.fillTables(client, 0.01);
>         sql(TpchHelper.getQuery(2));
>     }
> }
> {code}



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

Reply via email to