Skip to content

Commit

Permalink
Also use batch-based evaluation for left-joins.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenwenzel committed Jul 31, 2024
1 parent 5fb4a11 commit 0e3a1d3
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,24 @@ public void remove() throws QueryEvaluationException {
@Override
protected QueryEvaluationStep prepare(LeftJoin join, QueryEvaluationContext context) throws QueryEvaluationException {
if (useHashJoin(join.getLeftArg(), join.getRightArg())) {
return bindingSet -> new HashJoinIteration(KvinEvaluationStrategy.this, join.getLeftArg(), join.getRightArg(), bindingSet, true);
QueryEvaluationStep leftPrepared = precompile(join.getLeftArg(), context);
QueryEvaluationStep rightPrepared = precompile(join.getRightArg(), context);
String[] joinAttributes = HashJoinIteration.hashJoinAttributeNames(join);
return new BatchQueryEvaluationStep() {
@Override
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(BindingSet bindingSet) {
return new HashJoinIteration(leftPrepared, rightPrepared, bindingSet, true, joinAttributes, context);
}

@Override
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(List<BindingSet> bindingSets) {
return new HashJoinIteration(
BatchQueryEvaluationStep.evaluate(leftPrepared, bindingSets),
join.getLeftArg().getBindingNames(),
BatchQueryEvaluationStep.evaluate(rightPrepared, bindingSets),
join.getRightArg().getBindingNames(), true);
}
};
} else {
return super.prepare(join, context);
}
Expand Down

0 comments on commit 0e3a1d3

Please sign in to comment.