[CALCITE-3400] Implement left/right/semi/anti/full join in Interpreter#1496
[CALCITE-3400] Implement left/right/semi/anti/full join in Interpreter#1496yanlin-Lynn wants to merge 2 commits into
Conversation
| + rel.getRight().getRowType().getFieldCount(); | ||
| context.values = new Object[fieldCount]; | ||
|
|
||
| Source baseSource = leftSource; |
There was a problem hiding this comment.
Let's call it outer/inner source.
There was a problem hiding this comment.
@hsyuan Thanks for reviewing, just a little question.
Might it a little misleading by calling it outer/inner source?
It seems do not match well with semi/anti/full join.
Any more detail explanation for outer/inner?
There was a problem hiding this comment.
I don't think it is misleading. It is for outer relation or inner relation, not for the outer join or inner join. Look at the nested loop, the outer relation is used for outer loop, the inner relation is used for the inner loop.
There was a problem hiding this comment.
OK, got your point.
Updated.
There was a problem hiding this comment.
I think "outer" and "inner" are a bit misleading. Since outer is always left and inner is always right, how about we keep the names left and right? You could add a comment about left being the outer side of the nested loop.
There was a problem hiding this comment.
But for right outer join, the right relation is outer, left relation is inner.
61a6143 to
040c8a7
Compare
| /** Implementation of {@code MIN} function to calculate the minimum of | ||
| * {@code boolean} values as a user-defined aggregate. | ||
| */ | ||
| public static class MinBoolean { |
There was a problem hiding this comment.
For anti join, right input of the join may like this,
LogicalAggregate(group=[{0}], agg#0=[MIN($1)])
LogicalProject(X=[$0], $f1=[true])
LogicalValues(tuples=[[{ 1, 'd' }]])
so need to calculate the minimum of boolean values, use MinBoolean as a user-defined aggregate.
040c8a7 to
08fe1fd
Compare
| joinRows = new ArrayList<Row>(); | ||
| Row joinRow = null; | ||
| while ((joinRow = innerSource.receive()) != null) { | ||
| joinRows.add(joinRow); |
There was a problem hiding this comment.
And here. baseRow, joinRow to outerRow, innerRow...
There was a problem hiding this comment.
Oops, I miss that.
And the parameter of doJoin and doSend should also be updated, right?
I'll update them together.
There was a problem hiding this comment.
I unify all of them to outerRow and innerRow.
08fe1fd to
abb83e4
Compare
|
In method javadoc, you must use the 3rd person declarative (e.g. "Gets ...".) |
abb83e4 to
0f062e7
Compare
…r (Wang Yanlin)
For anti join, right input of the join may like this,
LogicalAggregate(group=[{0}], agg#0=[MIN($1)])
LogicalProject(X=[$0], $f1=[true])
LogicalValues(tuples=[[{ 1, 'd' }]])
so need to calculate the minimum of boolean values, use MinBoolean as a user-defined aggregate.
0f062e7 to
c38ea0e
Compare
| } | ||
| } | ||
| doSend(outerRow, matchInnerRows, joinRelType); | ||
| return ImmutableList.copyOf(matchInnerRows); |
There was a problem hiding this comment.
Do we need ImmutableList copy? matchRowSet.addAll() will copy them again, right?
There was a problem hiding this comment.
No, we do not need.
Updated
…r (Wang Yanlin)
For anti join, right input of the join may like this,
LogicalAggregate(group=[{0}], agg#0=[MIN($1)])
LogicalProject(X=[$0], $f1=[true])
LogicalValues(tuples=[[{ 1, 'd' }]])
so need to calculate the minimum of boolean values, use MinBoolean as a
user-defined aggregate.
Close apache#1496
…r (Wang Yanlin)
For anti join, right input of the join may like this,
LogicalAggregate(group=[{0}], agg#0=[MIN($1)])
LogicalProject(X=[$0], $f1=[true])
LogicalValues(tuples=[[{ 1, 'd' }]])
so need to calculate the minimum of boolean values, use MinBoolean as a
user-defined aggregate.
Close apache#1496
…r (Wang Yanlin)
For anti join, right input of the join may like this,
LogicalAggregate(group=[{0}], agg#0=[MIN($1)])
LogicalProject(X=[$0], $f1=[true])
LogicalValues(tuples=[[{ 1, 'd' }]])
so need to calculate the minimum of boolean values, use MinBoolean as a
user-defined aggregate.
Close apache#1496
…r (Wang Yanlin)
For anti join, right input of the join may like this,
LogicalAggregate(group=[{0}], agg#0=[MIN($1)])
LogicalProject(X=[$0], $f1=[true])
LogicalValues(tuples=[[{ 1, 'd' }]])
so need to calculate the minimum of boolean values, use MinBoolean as a
user-defined aggregate.
Close apache#1496
…r (Wang Yanlin)
For anti join, right input of the join may like this,
LogicalAggregate(group=[{0}], agg#0=[MIN($1)])
LogicalProject(X=[$0], $f1=[true])
LogicalValues(tuples=[[{ 1, 'd' }]])
so need to calculate the minimum of boolean values, use MinBoolean as a
user-defined aggregate.
Close apache#1496
Change-Id: I5aa61f0e341e5e45174e8867ffaf26ee26ec9f19
…r (Wang Yanlin)
For anti join, right input of the join may like this,
LogicalAggregate(group=[{0}], agg#0=[MIN($1)])
LogicalProject(X=[$0], $f1=[true])
LogicalValues(tuples=[[{ 1, 'd' }]])
so need to calculate the minimum of boolean values, use MinBoolean as a
user-defined aggregate.
Close apache#1496
Change-Id: I5aa61f0e341e5e45174e8867ffaf26ee26ec9f19
Currently, we can only interpreter inner join with Interpreter, because JoinNode only support inner join type.
This PR tries to add support more join types for
JoinNode