-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-5121: support empty left bind join (OPTIONAL) in FedX
Previously we introduced support for left bind joins in FedX. The case of empty left bind joins (i.e. where the clause inside the OPTIONAL does not provide any statements) was not handled and resulted in an exception This change now adds support for empty optional joins and passes the results from the left-handside through.
- Loading branch information
1 parent
ab02413
commit e6988bf
Showing
3 changed files
with
171 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
.../main/java/org/eclipse/rdf4j/federated/evaluation/join/ParallelEmptyBindLeftJoinTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Eclipse RDF4J contributors. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*******************************************************************************/ | ||
package org.eclipse.rdf4j.federated.evaluation.join; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.rdf4j.common.iteration.CloseableIteration; | ||
import org.eclipse.rdf4j.federated.algebra.EmptyStatementPattern; | ||
import org.eclipse.rdf4j.federated.evaluation.FederationEvalStrategy; | ||
import org.eclipse.rdf4j.federated.evaluation.concurrent.ParallelExecutor; | ||
import org.eclipse.rdf4j.federated.evaluation.concurrent.ParallelTaskBase; | ||
import org.eclipse.rdf4j.query.BindingSet; | ||
import org.eclipse.rdf4j.repository.sparql.federation.CollectionIteration; | ||
|
||
/** | ||
* A {@link ParallelTaskBase} for executing bind left joins, where the join argument is an | ||
* {@link EmptyStatementPattern}. The effective result is that the input bindings from the left operand are passed | ||
* through. | ||
* | ||
* @author Andreas Schwarte | ||
*/ | ||
public class ParallelEmptyBindLeftJoinTask extends ParallelTaskBase<BindingSet> { | ||
|
||
protected final FederationEvalStrategy strategy; | ||
protected final EmptyStatementPattern rightArg; | ||
protected final List<BindingSet> bindings; | ||
protected final ParallelExecutor<BindingSet> joinControl; | ||
|
||
public ParallelEmptyBindLeftJoinTask(ParallelExecutor<BindingSet> joinControl, FederationEvalStrategy strategy, | ||
EmptyStatementPattern expr, List<BindingSet> bindings) { | ||
this.strategy = strategy; | ||
this.rightArg = expr; | ||
this.bindings = bindings; | ||
this.joinControl = joinControl; | ||
} | ||
|
||
@Override | ||
public ParallelExecutor<BindingSet> getControl() { | ||
return joinControl; | ||
} | ||
|
||
@Override | ||
protected CloseableIteration<BindingSet> performTaskInternal() throws Exception { | ||
// simply return the input bindings (=> the empty statement pattern cannot add results) | ||
return new CollectionIteration<BindingSet>(bindings); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters