dstruct
Class ConcurrentOperatorsBucket

java.lang.Object
  extended by java.lang.Thread
      extended by dstruct.ConcurrentOperatorsBucket
All Implemented Interfaces:
java.lang.Runnable

public class ConcurrentOperatorsBucket
extends java.lang.Thread

An object of ConcurrentOperatorsBucket contains multiple statistical operators that can be executed in parallel. ConcurrentOperatorsBucket is the basic unit of the ExecutionPlan.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  java.util.HashSet<StatOperator> concurrentOperators
          Set of statistical operators in this bucket.
 int id
          ID of this bucket.
 java.util.HashSet<FelixPredicate> inputPredicates
          Predicates used as inputs.
(package private)  boolean isMarginal
          MAP/marginal.
(package private)  int nCore
          Degree of concurrent running of operators.
(package private)  java.util.ArrayList<StatOperator> operatorStacks
          When execute this bucket, this variable records the remaining operators.
(package private)  parser.CommandOptions options
          Command line options.
 java.util.HashSet<FelixPredicate> outputPredicates
          Predicates output by this bucket.
 int precedence
          Precedence of this bucket.
(package private)  boolean started
          Whether this bucket has ran its first operator.
 StatOperator.OPType type
          Type of operators in this bucket.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ConcurrentOperatorsBucket(boolean isMarginal)
          The constructor.
 
Method Summary
 void addOperator(StatOperator sop)
          Add an operator into this bucket.
 void cleanUp()
          Merge the output of operators into a consistent DB table and dump them into files.
 void dumpMapAnswerForPredicate(db.RDB db, java.lang.String fout, FelixPredicate p)
          Output the results of this bucket.
 java.util.HashSet<StatOperator> getOperators()
          Get all operators in this bucket.
 int getPrecedence()
          Get the precedence of this bucket.
 boolean isMarginal()
          Whether this bucket runs in marginal mode.
 void myJoin()
          Return if only if all the operators have been executed.
 void run()
          Run all operators in this bucket.
 void runNextOperatorInBucket()
          Run the next operator in this bucket.
 void setNCore(int _nCore)
          Set the degree of concurrency.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

concurrentOperators

java.util.HashSet<StatOperator> concurrentOperators
Set of statistical operators in this bucket.


operatorStacks

java.util.ArrayList<StatOperator> operatorStacks
When execute this bucket, this variable records the remaining operators.


inputPredicates

public java.util.HashSet<FelixPredicate> inputPredicates
Predicates used as inputs.


outputPredicates

public java.util.HashSet<FelixPredicate> outputPredicates
Predicates output by this bucket.


nCore

int nCore
Degree of concurrent running of operators.


isMarginal

boolean isMarginal
MAP/marginal.


started

boolean started
Whether this bucket has ran its first operator. This variable is used to control some consistency issues.


id

public int id
ID of this bucket.


type

public StatOperator.OPType type
Type of operators in this bucket. The construction of buckets ensures all operators in it are with the same type.


precedence

public int precedence
Precedence of this bucket. The construction of buckets ensures all operators in it are with the same precedence.


options

parser.CommandOptions options
Command line options.

Constructor Detail

ConcurrentOperatorsBucket

public ConcurrentOperatorsBucket(boolean isMarginal)
The constructor.

Parameters:
isMarginal -
Method Detail

isMarginal

public boolean isMarginal()
Whether this bucket runs in marginal mode.

Returns:

getOperators

public java.util.HashSet<StatOperator> getOperators()
Get all operators in this bucket.

Returns:

getPrecedence

public int getPrecedence()
Get the precedence of this bucket.

Returns:

addOperator

public void addOperator(StatOperator sop)
Add an operator into this bucket.

Parameters:
sop -

setNCore

public void setNCore(int _nCore)
Set the degree of concurrency.

Parameters:
_nCore -

run

public void run()
Run all operators in this bucket.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

cleanUp

public void cleanUp()
Merge the output of operators into a consistent DB table and dump them into files.


runNextOperatorInBucket

public void runNextOperatorInBucket()
Run the next operator in this bucket.


myJoin

public void myJoin()
Return if only if all the operators have been executed.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Thread

dumpMapAnswerForPredicate

public void dumpMapAnswerForPredicate(db.RDB db,
                                      java.lang.String fout,
                                      FelixPredicate p)
Output the results of this bucket.

Parameters:
db -
fout -
p -