felix.dstruct
Class OperatorBucketGraph

java.lang.Object
  extended by felix.dstruct.OperatorBucketGraph

public class OperatorBucketGraph
extends java.lang.Object

The class of an OperatorBucketGraph. Each operator graph contains 1) a set of ConcurrentOperatorsBucket; and 2) Dependencies between different buckets. Current assumption is DAG (although there are no data-structure-level constraints for DAG, some algorithms may become trivial when dealing with cycles). An OperatorBucketGraph is a complete description of the logic plan.

Author:
Ce Zhang

Field Summary
 java.util.HashMap<ConcurrentOperatorsBucket,java.util.HashSet<ConcurrentOperatorsBucket>> downStreams
          Map from the bucket to its downstream buckets.
 java.util.HashMap<ConcurrentOperatorsBucket,java.util.HashSet<ConcurrentOperatorsBucket>> upStreams
          Map from the bucket to its upstream buckets.
 
Constructor Summary
OperatorBucketGraph()
           
 
Method Summary
 void addOperator(ConcurrentOperatorsBucket sop)
          Add a new bucket to this OperatorBucketGraph.
 java.util.HashSet<ConcurrentOperatorsBucket> getDownStreamOperator(ConcurrentOperatorsBucket oup)
          Gets all downstream buckets of the given bucket.
 ConcurrentOperatorsBucket getOneRandomOperator()
          Randomly pick one bucket in this OperatorBucketGraph.
 java.util.HashSet<ConcurrentOperatorsBucket> getOperators()
          Return the set of buckets in this OperatorBucketGraph.
 java.util.HashSet<ConcurrentOperatorsBucket> getUpStreamOperator(ConcurrentOperatorsBucket sop)
          Gets all upstream buckets of the given bucket.
 void parseDependency()
          Parse the dependency between buckets.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

upStreams

public java.util.HashMap<ConcurrentOperatorsBucket,java.util.HashSet<ConcurrentOperatorsBucket>> upStreams
Map from the bucket to its upstream buckets.


downStreams

public java.util.HashMap<ConcurrentOperatorsBucket,java.util.HashSet<ConcurrentOperatorsBucket>> downStreams
Map from the bucket to its downstream buckets.

Constructor Detail

OperatorBucketGraph

public OperatorBucketGraph()
Method Detail

addOperator

public void addOperator(ConcurrentOperatorsBucket sop)
Add a new bucket to this OperatorBucketGraph. An ID will be automatically assigned to this bucket.

Parameters:
sop - statistical operator.

parseDependency

public void parseDependency()
Parse the dependency between buckets. This function will transform the input/output predicates information of each statistical bucket into the upstream/downstream relations between statistical buckets. Note that, this upstream/downstream relation is only a preference and is not necessarily as the same as the final execution plan.


getOperators

public java.util.HashSet<ConcurrentOperatorsBucket> getOperators()
Return the set of buckets in this OperatorBucketGraph.


getOneRandomOperator

public ConcurrentOperatorsBucket getOneRandomOperator()
Randomly pick one bucket in this OperatorBucketGraph.


getUpStreamOperator

public java.util.HashSet<ConcurrentOperatorsBucket> getUpStreamOperator(ConcurrentOperatorsBucket sop)
Gets all upstream buckets of the given bucket.


getDownStreamOperator

public java.util.HashSet<ConcurrentOperatorsBucket> getDownStreamOperator(ConcurrentOperatorsBucket oup)
Gets all downstream buckets of the given bucket.