Hi
I wonder when will the exchange node be added to the execution plan. For
example, In Spark, if a join is SMJ(SortMergeJoin), it will add an exchange
and a sort node to the execution plan:

[image: 3631580619602_.pic.jpg]

In Calcite, Let me use CsvTest#testReadme for example and I can find a
sorting trait if the join is SMJ, but I can not find an exchange.

The SQL:

SELECT d.name, COUNT(*) cnt
FROM emps AS e
JOIN depts AS d ON e.deptno = d.deptno
GROUP BY d.name;

The plan in volcano planner, see
`rel#76:EnumerableMergeJoin.ENUMERABLE.[[0], [2]]`, we can see the
conversion and the Collation, but no distribution.

appendix

Set#6, type: RecordType(INTEGER DEPTNO, VARCHAR NAME, INTEGER DEPTNO0)
    rel#51:Subset#6.NONE.[], best=null, importance=0.6561

rel#49:LogicalJoin.NONE.[](left=RelSubset#30,right=RelSubset#29,condition==($2,
$0),joinType=inner), rowcount=1500.0, cumulative cost={inf}

rel#60:LogicalProject.NONE.[](input=RelSubset#32,DEPTNO=$1,NAME=$2,DEPTNO0=$0),
rowcount=1500.0, cumulative cost={inf}
    rel#55:Subset#6.ENUMERABLE.[], best=rel#78,
importance=0.7290000000000001

rel#70:EnumerableProject.ENUMERABLE.[](input=RelSubset#46,DEPTNO=$1,NAME=$2,DEPTNO0=$0),
rowcount=1500.0, cumulative cost={3686.517018598809 rows, 4626.25 cpu, 0.0
io}
        rel#76:EnumerableMergeJoin.ENUMERABLE.[[0],
[2]](left=RelSubset#74,right=RelSubset#75,condition==($2,
$0),joinType=inner), rowcount=1500.0, cumulative cost={inf}

rel#78:EnumerableHashJoin.ENUMERABLE.[](left=RelSubset#30,right=RelSubset#69,condition==($0,
$2),joinType=inner), rowcount=1500.0, cumulative cost={2185.517018598809
rows, 126.25 cpu, 0.0 io}

--
Regards!

Aron Tao


-- 

Regards!

Aron Tao

Reply via email to