Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
We generate correlated join when no correlate variable is present on the right side. However, this could be simplified to emit a normal join.
Given:
final RelNode rel = builder .scan("EMP") .variable(v) .scan("DEPT") .join(JoinRelType.LEFT, builder.equals(builder.field(2, 0, "SAL"), builder.literal(1000)), ImmutableSet.of(v.get().id)) .build();
Currently the following is emitted:
LogicalFilter(condition=[=($7, $8)]) LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}]) LogicalTableScan(table=[[scott, EMP]]) LogicalFilter(condition=[=($cor0.DEPTNO, $0)]) LogicalTableScan(table=[[scott, DEPT]])
After the changes the following will be emitted:
LogicalJoin(condition=[=($7, $8)], joinType=[left]) LogicalTableScan(table=[[scott, EMP]]) LogicalTableScan(table=[[scott, DEPT]])
Attachments
Issue Links
- links to