Skip to content

Commit 27cd444

Browse files
committed
wip
1 parent 2bb9466 commit 27cd444

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/optimizer/sparqluo

core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/optimizer/sparqluo/BeCostEstimator.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ private SegmentEstimate estimateJoinSegment(List<BeNode> segment, BindingInfo se
9191
}
9292

9393
List<BeNode> remaining = new ArrayList<>(segment);
94+
Map<BeNode, NodeEstimate> estimates = new IdentityHashMap<>();
95+
for (BeNode node : segment) {
96+
estimates.put(node, estimateNode(node));
97+
}
9498
double cost = 0.0;
9599
double currentSize = seedSize;
96100
BindingInfo currentInfo = seedInfo;
@@ -100,7 +104,7 @@ private SegmentEstimate estimateJoinSegment(List<BeNode> segment, BindingInfo se
100104
NodeEstimate bestEstimate = null;
101105
double bestScore = Double.POSITIVE_INFINITY;
102106
for (BeNode candidate : remaining) {
103-
NodeEstimate estimate = estimateNode(candidate);
107+
NodeEstimate estimate = estimates.get(candidate);
104108
int sharedVars = sharedAssuredCount(currentInfo, estimate.info);
105109
double joinedSize = fAnd(currentSize, estimate.resultSize, sharedVars);
106110
double score = estimate.cost + joinedSize;

0 commit comments

Comments
 (0)