Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ private JoinStatementWithBindingSetIterator getIteration(BindingSet bindings) {
}

if (iteration instanceof IndexReportingIterator) {
statementPattern.setIndexName(((IndexReportingIterator) iteration).getIndexName());
statementPattern.setIndexNameSupplier(
((IndexReportingIterator) iteration)::getIndexName);
} else {
statementPattern.setIndexName(null);
}

if (iteration instanceof EmptyIteration) {
Expand Down Expand Up @@ -329,7 +332,10 @@ private ConvertStatementToBindingSetIterator getIteration() {
iteration = tripleSource.getStatements((Resource) subject, (IRI) predicate, object, contexts);
}
if (iteration instanceof IndexReportingIterator) {
statementPattern.setIndexName(((IndexReportingIterator) iteration).getIndexName());
statementPattern.setIndexNameSupplier(
((IndexReportingIterator) iteration)::getIndexName);
} else {
statementPattern.setIndexName(null);
}

if (iteration instanceof EmptyIteration) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;

import org.eclipse.rdf4j.common.annotation.Experimental;
Expand Down Expand Up @@ -65,6 +66,7 @@ public enum Scope {
private StatementOrder statementOrder;

private String indexName;
private transient Supplier<String> indexNameSupplier;

private Set<String> assuredBindingNames;
private List<Var> varList;
Expand Down Expand Up @@ -537,11 +539,22 @@ public Var getOrder() {

@Experimental
public String getIndexName() {
if (indexNameSupplier != null) {
indexName = indexNameSupplier.get();
indexNameSupplier = null;
}
return indexName;
}

@Experimental
public void setIndexName(String indexName) {
this.indexName = indexName;
this.indexNameSupplier = null;
}

@Experimental
public void setIndexNameSupplier(Supplier<String> indexNameSupplier) {
this.indexNameSupplier = indexNameSupplier;
this.indexName = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.eclipse.rdf4j.query.algebra.BinaryTupleOperator;
import org.eclipse.rdf4j.query.algebra.QueryModelNode;
import org.eclipse.rdf4j.query.algebra.QueryRoot;
import org.eclipse.rdf4j.query.algebra.StatementPattern;
import org.eclipse.rdf4j.query.algebra.VariableScopeChange;
import org.eclipse.rdf4j.query.explanation.GenericPlanNode;

Expand Down Expand Up @@ -44,6 +45,9 @@ public GenericPlanNode getGenericPlanNode() {

@Override
protected void meetNode(QueryModelNode node) {
if (node instanceof StatementPattern) {
((StatementPattern) node).getIndexName();
}
GenericPlanNode genericPlanNode = new GenericPlanNode(node.getSignature());
genericPlanNode.setCostEstimate(node.getCostEstimate());
genericPlanNode.setResultSizeEstimate(node.getResultSizeEstimate());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@

import org.eclipse.rdf4j.common.annotation.InternalUseOnly;
import org.eclipse.rdf4j.common.iteration.CloseableIteration;
import org.eclipse.rdf4j.common.iteration.IndexReportingIterator;
import org.eclipse.rdf4j.query.QueryEvaluationException;

@InternalUseOnly
public class TripleSourceIterationWrapper<T> implements CloseableIteration<T> {
public class TripleSourceIterationWrapper<T> implements CloseableIteration<T>, IndexReportingIterator {

private final CloseableIteration<? extends T> delegate;
private boolean closed = false;
Expand All @@ -28,6 +29,14 @@ public TripleSourceIterationWrapper(CloseableIteration<? extends T> delegate) {
this.delegate = Objects.requireNonNull(delegate, "The iterator was null");
}

@Override
public String getIndexName() {
if (delegate instanceof IndexReportingIterator) {
return ((IndexReportingIterator) delegate).getIndexName();
}
return null;
}

/**
* Checks whether the underlying iteration contains more elements.
*
Expand Down
Loading
Loading