Search in sources :

Example 6 with InterestingProperties

use of org.apache.flink.optimizer.dataproperties.InterestingProperties in project flink by apache.

the class DataSinkNode method getAlternativePlans.

// --------------------------------------------------------------------------------------------
//                                   Recursive Optimization
// --------------------------------------------------------------------------------------------
@Override
public List<PlanNode> getAlternativePlans(CostEstimator estimator) {
    // check if we have a cached version
    if (this.cachedPlans != null) {
        return this.cachedPlans;
    }
    // calculate alternative sub-plans for predecessor
    List<? extends PlanNode> subPlans = getPredecessorNode().getAlternativePlans(estimator);
    List<PlanNode> outputPlans = new ArrayList<PlanNode>();
    final int parallelism = getParallelism();
    final int inDop = getPredecessorNode().getParallelism();
    final ExecutionMode executionMode = this.input.getDataExchangeMode();
    final boolean dopChange = parallelism != inDop;
    final boolean breakPipeline = this.input.isBreakingPipeline();
    InterestingProperties ips = this.input.getInterestingProperties();
    for (PlanNode p : subPlans) {
        for (RequestedGlobalProperties gp : ips.getGlobalProperties()) {
            for (RequestedLocalProperties lp : ips.getLocalProperties()) {
                Channel c = new Channel(p);
                gp.parameterizeChannel(c, dopChange, executionMode, breakPipeline);
                lp.parameterizeChannel(c);
                c.setRequiredLocalProps(lp);
                c.setRequiredGlobalProps(gp);
                // no need to check whether the created properties meet what we need in case
                // of ordering or global ordering, because the only interesting properties we have
                // are what we require
                outputPlans.add(new SinkPlanNode(this, "DataSink (" + this.getOperator().getName() + ")", c));
            }
        }
    }
    // cost and prune the plans
    for (PlanNode node : outputPlans) {
        estimator.costOperator(node);
    }
    prunePlanAlternatives(outputPlans);
    this.cachedPlans = outputPlans;
    return outputPlans;
}
Also used : RequestedGlobalProperties(org.apache.flink.optimizer.dataproperties.RequestedGlobalProperties) RequestedLocalProperties(org.apache.flink.optimizer.dataproperties.RequestedLocalProperties) PlanNode(org.apache.flink.optimizer.plan.PlanNode) SinkPlanNode(org.apache.flink.optimizer.plan.SinkPlanNode) Channel(org.apache.flink.optimizer.plan.Channel) ArrayList(java.util.ArrayList) InterestingProperties(org.apache.flink.optimizer.dataproperties.InterestingProperties) SinkPlanNode(org.apache.flink.optimizer.plan.SinkPlanNode) ExecutionMode(org.apache.flink.api.common.ExecutionMode)

Example 7 with InterestingProperties

use of org.apache.flink.optimizer.dataproperties.InterestingProperties in project flink by apache.

the class DataSinkNode method computeInterestingPropertiesForInputs.

@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
    final InterestingProperties iProps = new InterestingProperties();
    {
        final RequestedGlobalProperties partitioningProps = new RequestedGlobalProperties();
        iProps.addGlobalProperties(partitioningProps);
    }
    {
        final Ordering localOrder = getOperator().getLocalOrder();
        final RequestedLocalProperties orderProps = new RequestedLocalProperties();
        if (localOrder != null) {
            orderProps.setOrdering(localOrder);
        }
        iProps.addLocalProperties(orderProps);
    }
    this.input.setInterestingProperties(iProps);
}
Also used : RequestedGlobalProperties(org.apache.flink.optimizer.dataproperties.RequestedGlobalProperties) RequestedLocalProperties(org.apache.flink.optimizer.dataproperties.RequestedLocalProperties) Ordering(org.apache.flink.api.common.operators.Ordering) InterestingProperties(org.apache.flink.optimizer.dataproperties.InterestingProperties)

Example 8 with InterestingProperties

use of org.apache.flink.optimizer.dataproperties.InterestingProperties in project flink by apache.

the class WorksetIterationNode method computeInterestingPropertiesForInputs.

@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
    // our own solution (the solution set) is always partitioned and this cannot be adjusted
    // depending on what the successor to the workset iteration requests. for that reason,
    // we ignore incoming interesting properties.
    // in addition, we need to make 2 interesting property passes, because the root of the step function 
    // that computes the next workset needs the interesting properties as generated by the
    // workset source of the step function. the second pass concerns only the workset path.
    // as initial interesting properties, we have the trivial ones for the step function,
    // and partitioned on the solution set key for the solution set delta 
    RequestedGlobalProperties partitionedProperties = new RequestedGlobalProperties();
    partitionedProperties.setHashPartitioned(this.solutionSetKeyFields);
    InterestingProperties partitionedIP = new InterestingProperties();
    partitionedIP.addGlobalProperties(partitionedProperties);
    partitionedIP.addLocalProperties(new RequestedLocalProperties());
    this.nextWorksetRootConnection.setInterestingProperties(new InterestingProperties());
    this.solutionSetDeltaRootConnection.setInterestingProperties(partitionedIP.clone());
    InterestingPropertyVisitor ipv = new InterestingPropertyVisitor(estimator);
    this.nextWorkset.accept(ipv);
    this.solutionSetDelta.accept(ipv);
    // take the interesting properties of the partial solution and add them to the root interesting properties
    InterestingProperties worksetIntProps = this.worksetNode.getInterestingProperties();
    InterestingProperties intProps = new InterestingProperties();
    intProps.getGlobalProperties().addAll(worksetIntProps.getGlobalProperties());
    intProps.getLocalProperties().addAll(worksetIntProps.getLocalProperties());
    // clear all interesting properties to prepare the second traversal
    this.nextWorksetRootConnection.clearInterestingProperties();
    this.nextWorkset.accept(InterestingPropertiesClearer.INSTANCE);
    // 2nd pass
    this.nextWorksetRootConnection.setInterestingProperties(intProps);
    this.nextWorkset.accept(ipv);
    // now add the interesting properties of the workset to the workset input
    final InterestingProperties inProps = this.worksetNode.getInterestingProperties().clone();
    inProps.addGlobalProperties(new RequestedGlobalProperties());
    inProps.addLocalProperties(new RequestedLocalProperties());
    this.input2.setInterestingProperties(inProps);
    // the partial solution must be hash partitioned, so it has only that as interesting properties
    this.input1.setInterestingProperties(partitionedIP);
}
Also used : RequestedGlobalProperties(org.apache.flink.optimizer.dataproperties.RequestedGlobalProperties) RequestedLocalProperties(org.apache.flink.optimizer.dataproperties.RequestedLocalProperties) InterestingProperties(org.apache.flink.optimizer.dataproperties.InterestingProperties) InterestingPropertyVisitor(org.apache.flink.optimizer.traversals.InterestingPropertyVisitor)

Aggregations

InterestingProperties (org.apache.flink.optimizer.dataproperties.InterestingProperties)8 RequestedGlobalProperties (org.apache.flink.optimizer.dataproperties.RequestedGlobalProperties)6 RequestedLocalProperties (org.apache.flink.optimizer.dataproperties.RequestedLocalProperties)6 InterestingPropertyVisitor (org.apache.flink.optimizer.traversals.InterestingPropertyVisitor)2 ArrayList (java.util.ArrayList)1 ExecutionMode (org.apache.flink.api.common.ExecutionMode)1 Ordering (org.apache.flink.api.common.operators.Ordering)1 OperatorDescriptorDual (org.apache.flink.optimizer.operators.OperatorDescriptorDual)1 GlobalPropertiesPair (org.apache.flink.optimizer.operators.OperatorDescriptorDual.GlobalPropertiesPair)1 LocalPropertiesPair (org.apache.flink.optimizer.operators.OperatorDescriptorDual.LocalPropertiesPair)1 OperatorDescriptorSingle (org.apache.flink.optimizer.operators.OperatorDescriptorSingle)1 Channel (org.apache.flink.optimizer.plan.Channel)1 PlanNode (org.apache.flink.optimizer.plan.PlanNode)1 SinkPlanNode (org.apache.flink.optimizer.plan.SinkPlanNode)1