dstruct
Class OperatorBucketGraph

java.lang.Object
  extended by 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
(package private)  int counter
          Counter for buckets in this OperatorBucketGraph.
 java.util.HashMap<ConcurrentOperatorsBucket,java.util.HashSet<ConcurrentOperatorsBucket>> downStreams
          Map from the bucket to its downstream buckets.
(package private)  java.util.HashSet<ConcurrentOperatorsBucket> operators
          Set of operators in this OperatorBucketGraph.
 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.
private  void addOperatorRelation(ConcurrentOperatorsBucket upStream, ConcurrentOperatorsBucket downStream)
          Add a new bucket relation to this OperatorBucketGraph.
 java.util.HashSet<ConcurrentOperatorsBucket> getDownStreamOperator(StatOperator sop)
          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(StatOperator sop)
          Gets all upstream buckets of the given bucket.
 void parseDependency()
          Parse the dependency between buckets.
 java.lang.String toString()
          Human-readable representation of an OperatorBucketGraph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

counter

int counter
Counter for buckets in this OperatorBucketGraph.


operators

java.util.HashSet<ConcurrentOperatorsBucket> operators
Set of operators in this OperatorBucketGraph.


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.

addOperatorRelation

private void addOperatorRelation(ConcurrentOperatorsBucket upStream,
                                 ConcurrentOperatorsBucket downStream)
Add a new bucket relation to this OperatorBucketGraph. Here by ``bucket relation'' it means a directed edge between two buckets from upstream to downstream.

Parameters:
upStream -
downStream -

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(StatOperator sop)
Gets all upstream buckets of the given bucket.


getDownStreamOperator

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


toString

public java.lang.String toString()
Human-readable representation of an OperatorBucketGraph. A sample looks like:
#####OPERATOR BUCKET 1#####
++Type: COREF
++Required Predicates:
fullcrt
pmention
badNames
mentionPhone
crt
mentionPhone_map
++Output Predicates:
pcluster
++Get Information From:
OPERATOR 2 (TUFFY)
++Provide Information To:
OPERATOR 2 (TUFFY)

#####OPERATOR BUCKET 2#####
...
TODO: draw dependency graph for operators.

Overrides:
toString in class java.lang.Object