[ 
https://issues.apache.org/jira/browse/IGNITE-26048?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18033006#comment-18033006
 ] 

Ignite TC Bot commented on IGNITE-26048:
----------------------------------------

{panel:title=Branch: [pull/12284/head] Base: [master] : No blockers 
found!|borderStyle=dashed|borderColor=#ccc|titleBGColor=#D6F7C1}{panel}
{panel:title=Branch: [pull/12284/head] Base: [master] : New Tests 
(9)|borderStyle=dashed|borderColor=#ccc|titleBGColor=#D6F7C1}
{color:#00008b}Calcite SQL{color} [[tests 
9|https://ci2.ignite.apache.org/viewLog.html?buildId=8668691]]
* {color:#013220}IgniteCalciteTestSuite: 
JoinIntegrationTest.testIsNotDistinctWithEquiConditionFrom[sqlTxMode=ALL,joinType=NESTED_LOOP]
 - PASSED{color}
* {color:#013220}IgniteCalciteTestSuite: 
JoinIntegrationTest.testIsNotDistinctWithEquiConditionFrom[sqlTxMode=ALL,joinType=CORRELATED]
 - PASSED{color}
* {color:#013220}IgniteCalciteTestSuite: 
JoinIntegrationTest.testIsNotDistinctWithEquiConditionFrom[sqlTxMode=ALL,joinType=MERGE]
 - PASSED{color}
* {color:#013220}IgniteCalciteTestSuite: 
JoinIntegrationTest.testIsNotDistinctWithEquiConditionFrom[sqlTxMode=NONE,joinType=CORRELATED]
 - PASSED{color}
* {color:#013220}IgniteCalciteTestSuite: 
JoinIntegrationTest.testIsNotDistinctWithEquiConditionFrom[sqlTxMode=NONE,joinType=MERGE]
 - PASSED{color}
* {color:#013220}IgniteCalciteTestSuite: 
JoinIntegrationTest.testIsNotDistinctWithEquiConditionFrom[sqlTxMode=RANDOM,joinType=MERGE]
 - PASSED{color}
* {color:#013220}IgniteCalciteTestSuite: 
JoinIntegrationTest.testIsNotDistinctWithEquiConditionFrom[sqlTxMode=RANDOM,joinType=NESTED_LOOP]
 - PASSED{color}
* {color:#013220}IgniteCalciteTestSuite: 
JoinIntegrationTest.testIsNotDistinctWithEquiConditionFrom[sqlTxMode=NONE,joinType=NESTED_LOOP]
 - PASSED{color}
* {color:#013220}IgniteCalciteTestSuite: 
JoinIntegrationTest.testIsNotDistinctWithEquiConditionFrom[sqlTxMode=RANDOM,joinType=CORRELATED]
 - PASSED{color}

{panel}
[TeamCity *--> Run :: All* 
Results|https://ci2.ignite.apache.org/viewLog.html?buildId=8668776&buildTypeId=IgniteTests24Java8_RunAll]

> Calcite. Incorrect processing of IS NOT DISTINCT condition in MergeJoin.
> ------------------------------------------------------------------------
>
>                 Key: IGNITE-26048
>                 URL: https://issues.apache.org/jira/browse/IGNITE-26048
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 2.17
>            Reporter: Vladimir Steshin
>            Assignee: Vladimir Steshin
>            Priority: Major
>              Labels: calcite, ignite-2, ise
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> *Reproducer:*
> {code:java}
> @RunWith(Parameterized.class) public class JoinIntegrationTest extends 
> AbstractBasicIntegrationTransactionalTest {
>    @Test public void testIsNotDistinctFrom() { 
>       assertQuery("select t1.c1, t2.c1, t2.c2 from t1 join t2 on t1.c2 is not 
> distinct from t2.c2 and t1.c1 = t2.c3 - 1")
>       .returns(2, 3, null)
>       .check(); 
>    }
> }
> {code}
> *Error:*
> {code:java}
> Test failed 
> [test=JoinIntegrationTest#testIsNotDistinctFrom[sqlTxMode=ALL,joinType=MERGE],
>  duration=117] 
> java.lang.AssertionError: Collections sizes are not equal:
>    Expected: [[2, 3, null]] Actual:   [] 
>    expected:<1> but was:<0> {code}
> *Note:*
> Works for _NL_JOIN_ and {_}CNL_JOIN{_}.
>  
> *Suppose:*
> We incorrectly parse join condition in `{_}MergeJoinConverterRule{_}`:
> {code:java}
> @Override public boolean matchesJoin(RelOptRuleCall call) {
>     LogicalJoin logicalJoin = call.rel(0);
>     return !F.isEmpty(logicalJoin.analyzeCondition().pairs()) && 
> logicalJoin.analyzeCondition().isEqui();
> } {code}
> and when creating the comparator in 
> `{_}LogicalRelImplementor#visit(IgniteMergeJoin rel){_}`:
> {code:java}
> Comparator<Row> comp = expressionFactory.comparator(
>     rel.leftCollation().getFieldCollations().subList(0, pairsCnt),
>     rel.rightCollation().getFieldCollations().subList(0, pairsCnt),
>     rel.getCondition().getKind() == IS_NOT_DISTINCT_FROM || 
> rel.getCondition().getKind() == IS_DISTINCT_FROM
> );
> Node<Row> node = MergeJoinNode.create(ctx, outType, leftType, rightType, 
> joinType, comp, hasExchange(rel)); {code}
> We assume that there is only one pair or all of the pairs are of _equi_ 
> condition or of {_}distinct/is not distinct{_}. But only one of several the 
> conditions might be {_}is not distinct{_}.
>  
> *Suggestions:*
>  # Disable _MergeJoin_ for this case for a while.
>  # Use more intelligent join condition analysis like 
> `{_}RelOptUtil#splitJoinCondition(){_}` and use separated comparators in 
> merge join node for join pair entries.
>  



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

Reply via email to