Search in sources :

Example 1 with InterestingProperties

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

the class OptimizerNode method computeUnionOfInterestingPropertiesFromSuccessors.

/**
	 * Computes all the interesting properties that are relevant to this node. The interesting
	 * properties are a union of the interesting properties on each outgoing connection.
	 * However, if two interesting properties on the outgoing connections overlap,
	 * the interesting properties will occur only once in this set. For that, this
	 * method deduplicates and merges the interesting properties.
	 * This method returns copies of the original interesting properties objects and
	 * leaves the original objects, contained by the connections, unchanged.
	 */
public void computeUnionOfInterestingPropertiesFromSuccessors() {
    List<DagConnection> conns = getOutgoingConnections();
    if (conns.size() == 0) {
        // no incoming, we have none ourselves
        this.intProps = new InterestingProperties();
    } else {
        this.intProps = conns.get(0).getInterestingProperties().clone();
        for (int i = 1; i < conns.size(); i++) {
            this.intProps.addInterestingProperties(conns.get(i).getInterestingProperties());
        }
    }
    this.intProps.dropTrivials();
}
Also used : InterestingProperties(org.apache.flink.optimizer.dataproperties.InterestingProperties)

Example 2 with InterestingProperties

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

the class SingleInputNode method computeInterestingPropertiesForInputs.

@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
    // get what we inherit and what is preserved by our user code 
    final InterestingProperties props = getInterestingProperties().filterByCodeAnnotations(this, 0);
    // add all properties relevant to this node
    for (OperatorDescriptorSingle dps : getPossibleProperties()) {
        for (RequestedGlobalProperties gp : dps.getPossibleGlobalProperties()) {
            if (gp.getPartitioning().isPartitionedOnKey()) {
                for (RequestedGlobalProperties contained : props.getGlobalProperties()) {
                    if (contained.getPartitioning() == gp.getPartitioning() && gp.getPartitionedFields().isValidSubset(contained.getPartitionedFields())) {
                        props.getGlobalProperties().remove(contained);
                        break;
                    }
                }
            }
            props.addGlobalProperties(gp);
        }
        for (RequestedLocalProperties lp : dps.getPossibleLocalProperties()) {
            props.addLocalProperties(lp);
        }
    }
    this.inConn.setInterestingProperties(props);
    for (DagConnection conn : getBroadcastConnections()) {
        conn.setInterestingProperties(new InterestingProperties());
    }
}
Also used : OperatorDescriptorSingle(org.apache.flink.optimizer.operators.OperatorDescriptorSingle) RequestedGlobalProperties(org.apache.flink.optimizer.dataproperties.RequestedGlobalProperties) RequestedLocalProperties(org.apache.flink.optimizer.dataproperties.RequestedLocalProperties) InterestingProperties(org.apache.flink.optimizer.dataproperties.InterestingProperties)

Example 3 with InterestingProperties

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

the class TwoInputNode method computeInterestingPropertiesForInputs.

@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
    // get what we inherit and what is preserved by our user code 
    final InterestingProperties props1 = getInterestingProperties().filterByCodeAnnotations(this, 0);
    final InterestingProperties props2 = getInterestingProperties().filterByCodeAnnotations(this, 1);
    // add all properties relevant to this node
    for (OperatorDescriptorDual dpd : getProperties()) {
        for (GlobalPropertiesPair gp : dpd.getPossibleGlobalProperties()) {
            // input 1
            props1.addGlobalProperties(gp.getProperties1());
            // input 2
            props2.addGlobalProperties(gp.getProperties2());
        }
        for (LocalPropertiesPair lp : dpd.getPossibleLocalProperties()) {
            // input 1
            props1.addLocalProperties(lp.getProperties1());
            // input 2
            props2.addLocalProperties(lp.getProperties2());
        }
    }
    this.input1.setInterestingProperties(props1);
    this.input2.setInterestingProperties(props2);
    for (DagConnection conn : getBroadcastConnections()) {
        conn.setInterestingProperties(new InterestingProperties());
    }
}
Also used : InterestingProperties(org.apache.flink.optimizer.dataproperties.InterestingProperties) GlobalPropertiesPair(org.apache.flink.optimizer.operators.OperatorDescriptorDual.GlobalPropertiesPair) OperatorDescriptorDual(org.apache.flink.optimizer.operators.OperatorDescriptorDual) LocalPropertiesPair(org.apache.flink.optimizer.operators.OperatorDescriptorDual.LocalPropertiesPair)

Example 4 with InterestingProperties

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

the class BinaryUnionNode method computeInterestingPropertiesForInputs.

@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
    final InterestingProperties props = getInterestingProperties();
    // if no other properties exist, add the pruned trivials back
    if (props.getGlobalProperties().isEmpty()) {
        props.addGlobalProperties(new RequestedGlobalProperties());
    }
    props.addLocalProperties(new RequestedLocalProperties());
    this.input1.setInterestingProperties(props.clone());
    this.input2.setInterestingProperties(props.clone());
    this.channelProps = props.getGlobalProperties();
}
Also used : RequestedGlobalProperties(org.apache.flink.optimizer.dataproperties.RequestedGlobalProperties) RequestedLocalProperties(org.apache.flink.optimizer.dataproperties.RequestedLocalProperties) InterestingProperties(org.apache.flink.optimizer.dataproperties.InterestingProperties)

Example 5 with InterestingProperties

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

the class BulkIterationNode method computeInterestingPropertiesForInputs.

@Override
public void computeInterestingPropertiesForInputs(CostEstimator estimator) {
    final InterestingProperties intProps = getInterestingProperties().clone();
    if (this.terminationCriterion != null) {
        // first propagate through termination Criterion. since it has no successors, it has no
        // interesting properties
        this.terminationCriterionRootConnection.setInterestingProperties(new InterestingProperties());
        this.terminationCriterion.accept(new InterestingPropertyVisitor(estimator));
    }
    // we need to make 2 interesting property passes, because the root of the step function needs also
    // the interesting properties as generated by the partial solution
    // give our own interesting properties (as generated by the iterations successors) to the step function and
    // make the first pass
    this.rootConnection.setInterestingProperties(intProps);
    this.nextPartialSolution.accept(new InterestingPropertyVisitor(estimator));
    // take the interesting properties of the partial solution and add them to the root interesting properties
    InterestingProperties partialSolutionIntProps = this.partialSolution.getInterestingProperties();
    intProps.getGlobalProperties().addAll(partialSolutionIntProps.getGlobalProperties());
    intProps.getLocalProperties().addAll(partialSolutionIntProps.getLocalProperties());
    // clear all interesting properties to prepare the second traversal
    // this clears only the path down from the next partial solution. The paths down
    // from the termination criterion (before they meet the paths down from the next partial solution)
    // remain unaffected by this step
    this.rootConnection.clearInterestingProperties();
    this.nextPartialSolution.accept(InterestingPropertiesClearer.INSTANCE);
    // 2nd pass
    this.rootConnection.setInterestingProperties(intProps);
    this.nextPartialSolution.accept(new InterestingPropertyVisitor(estimator));
    // now add the interesting properties of the partial solution to the input
    final InterestingProperties inProps = this.partialSolution.getInterestingProperties().clone();
    inProps.addGlobalProperties(new RequestedGlobalProperties());
    inProps.addLocalProperties(new RequestedLocalProperties());
    this.inConn.setInterestingProperties(inProps);
}
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