/** * Trigger the {@link CardinalityEstimationTraversal} for the given {@code traversal}. */ private void pushThroughPath(Tuple<OperatorAlternative.Alternative, CardinalityEstimationTraversal> traversal, Configuration configuration, OptimizationContext optimizationCtx) { // Perform the push. traversal.field1.traverse(optimizationCtx, configuration); }
/** * Traverse the {@link RheemPlan}, thereby updating {@link CardinalityEstimate}s. * * @return whether any {@link CardinalityEstimate}s have been updated */ public boolean pushCardinalities() { boolean isUpdated = this.getPlanTraversal().traverse(this.optimizationContext, this.configuration); this.optimizationContext.clearMarks(); return isUpdated; }
/** * Traverse the {@link RheemPlan}, thereby updating {@link CardinalityEstimate}s. Also update conversion * {@link Operator} cardinalities as provided by the {@link PlanImplementation}. * * @param planImplementation that has conversion {@link Operator}s * @return whether any {@link CardinalityEstimate}s have been updated */ public boolean pushCardinalities(PlanImplementation planImplementation) { boolean isUpdated = this.getPlanTraversal().traverse(this.optimizationContext, this.configuration); planImplementation.getLoopImplementations().keySet().forEach( loop -> this.optimizationContext.getNestedLoopContext(loop).getAggregateContext().updateOperatorContexts() ); this.updateConversionOperatorCardinalities(planImplementation, this.optimizationContext, 0); this.optimizationContext.clearMarks(); return isUpdated; }
@Override protected void doPush(OptimizationContext.OperatorContext opCtx, Configuration configuration) { // Kick the traversal off. this.traversal.traverse(opCtx.getOptimizationContext(), configuration); // Pull the cardinalities for the OutputSlots. Subplan subplan = (Subplan) opCtx.getOperator(); for (int outputIndex = 0; outputIndex < subplan.getNumOutputs(); outputIndex++) { final OutputSlot<?> innerOutput = subplan.traceOutput(subplan.getOutput(outputIndex)); if (innerOutput != null) { final OptimizationContext.OperatorContext innerOperatorCtx = opCtx.getOptimizationContext().getOperatorContext(innerOutput.getOwner()); final CardinalityEstimate cardinality = innerOperatorCtx.getOutputCardinality(innerOutput.getIndex()); opCtx.setOutputCardinality(outputIndex, cardinality); } } }
this.bodyTraversal.traverse(iterationCtx, configuration); for (OutputSlot<?> bodyOutputSlot : this.bodyOutputSlots) { final Operator bodyOperator = bodyOutputSlot.getOwner();