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

Evgeny Stanilovsky updated IGNITE-28986:
----------------------------------------
    Description: 
Local and specific partitions queries [1], [2] are broken if Exchange is 
raised. 

How to reproduce is master: 
For partitions (QueryWithPartitionsIntegrationTest) the same as for local : 
LocalQueryIntegrationTest#testJoin()
For exchange emulation i just modify a query : 

{code:java}
        String sql = "select /*+ MERGE_JOIN */* from " + table1 + " join " + 
table2 +
                        " on " + table1 + "." + joinCol + "=" + table2 + "." + 
joinCol;
{code}

and rel (IgniteMergeJoin) to make exchange relative plan more cheap:


{code:java}
IgniteMergeJoin#computeSelfCost -> 
//add
        RelNode stripped = getLeft().stripped();

        boolean inputScan = stripped instanceof TableScan;

        if (inputScan)
            return IgniteCost.HUGE;
{code}

and here we are :
plan becomes :

{code:java}
IgniteExchange
  IgniteMergeJoin
    IgniteExchange
      IgniteIndexScan
    IgniteExchange
      IgniteIndexScan
{code}

and tests fails with:

{code:java}
java.lang.AssertionError: expected:<3145> but was:<10000>
        at 
org.apache.ignite.internal.processors.query.calcite.integration.LocalQueryIntegrationTest.test(LocalQueryIntegrationTest.java:204)

{code}

Or (more simple re-producer), just create table with different affinity and try 
to join with local=true

It also work for Spool related plans, i.e. plans with spool are also will fail 
such a tests.

[1] https://issues.apache.org/jira/browse/IGNITE-19998 SQL Calcite: Add support 
of setting partitions in SqlFieldsQuery
[2] https://issues.apache.org/jira/browse/IGNITE-19725 Calcite-2. Add local 
flag support

  was:
Local and specific partitions queries [1], [2] are broken if Exchange is 
raised. 

How to reproduce is master: 
For partitions (QueryWithPartitionsIntegrationTest) the same as for local : 
LocalQueryIntegrationTest#testJoin()
For exchange emulation i just modify a query : 

{code:java}
        String sql = "select /*+ MERGE_JOIN */* from " + table1 + " join " + 
table2 +
                        " on " + table1 + "." + joinCol + "=" + table2 + "." + 
joinCol;
{code}

and rel (IgniteMergeJoin) to make exchange relative plan more cheap:


{code:java}
IgniteMergeJoin#computeSelfCost -> 
//add
        RelNode stripped = getLeft().stripped();

        boolean inputScan = stripped instanceof TableScan;

        if (inputScan)
            return IgniteCost.HUGE;
{code}

and here we are :
plan becomes :

{code:java}
IgniteExchange
  IgniteMergeJoin
    IgniteExchange
      IgniteIndexScan
    IgniteExchange
      IgniteIndexScan
{code}

and tests fails with:

{code:java}
java.lang.AssertionError: expected:<3145> but was:<10000>
        at 
org.apache.ignite.internal.processors.query.calcite.integration.LocalQueryIntegrationTest.test(LocalQueryIntegrationTest.java:204)

{code}

It also work for Spool related plans, i.e. plans with spool are also will fail 
such a tests.

[1] https://issues.apache.org/jira/browse/IGNITE-19998 SQL Calcite: Add support 
of setting partitions in SqlFieldsQuery
[2] https://issues.apache.org/jira/browse/IGNITE-19725 Calcite-2. Add local 
flag support


> Local and Partitions queries are broken if plan contains Exchange
> -----------------------------------------------------------------
>
>                 Key: IGNITE-28986
>                 URL: https://issues.apache.org/jira/browse/IGNITE-28986
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 2.18
>            Reporter: Evgeny Stanilovsky
>            Priority: Major
>              Labels: ignite-2, ise
>
> Local and specific partitions queries [1], [2] are broken if Exchange is 
> raised. 
> How to reproduce is master: 
> For partitions (QueryWithPartitionsIntegrationTest) the same as for local : 
> LocalQueryIntegrationTest#testJoin()
> For exchange emulation i just modify a query : 
> {code:java}
>         String sql = "select /*+ MERGE_JOIN */* from " + table1 + " join " + 
> table2 +
>                         " on " + table1 + "." + joinCol + "=" + table2 + "." 
> + joinCol;
> {code}
> and rel (IgniteMergeJoin) to make exchange relative plan more cheap:
> {code:java}
> IgniteMergeJoin#computeSelfCost -> 
> //add
>         RelNode stripped = getLeft().stripped();
>         boolean inputScan = stripped instanceof TableScan;
>         if (inputScan)
>             return IgniteCost.HUGE;
> {code}
> and here we are :
> plan becomes :
> {code:java}
> IgniteExchange
>   IgniteMergeJoin
>     IgniteExchange
>       IgniteIndexScan
>     IgniteExchange
>       IgniteIndexScan
> {code}
> and tests fails with:
> {code:java}
> java.lang.AssertionError: expected:<3145> but was:<10000>
>       at 
> org.apache.ignite.internal.processors.query.calcite.integration.LocalQueryIntegrationTest.test(LocalQueryIntegrationTest.java:204)
> {code}
> Or (more simple re-producer), just create table with different affinity and 
> try to join with local=true
> It also work for Spool related plans, i.e. plans with spool are also will 
> fail such a tests.
> [1] https://issues.apache.org/jira/browse/IGNITE-19998 SQL Calcite: Add 
> support of setting partitions in SqlFieldsQuery
> [2] https://issues.apache.org/jira/browse/IGNITE-19725 Calcite-2. Add local 
> flag support



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

Reply via email to