felix.dstruct
Class ConcurrentOperatorsBucket

java.lang.Object
  extended by java.lang.Thread
      extended by felix.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
 java.util.HashSet<java.lang.String> cleared
          Auxiliary structure for clearing the old data table and merge the output of statistical operators in this bucket.
 java.util.HashSet<FelixPredicate> commonCandidates
          Set of predicates that can potentially share with others (through dual decomposition).
 java.util.HashSet<FelixPredicate> dd_CommonOutput
          Relations that are shared with other buckets through dual decomposition.
 java.util.HashMap<FelixPredicate,java.lang.String> dd_commonOutputPredicate_2_priorTableName
          Map from relations in dd_CommonOutput to tables containing their corresponding Langragian Multipliers.
 java.util.HashMap<FelixPredicate,java.lang.String> dd_commonOutputPredicate_2_tableName
          Map from relations in dd_CommonOutput to tables containing their temporary output result in each iteration.
 int id
          ID of this bucket.
 java.util.HashSet<FelixPredicate> inputPredicates
          Predicates used as inputs.
 java.util.HashSet<java.lang.String> inputPredicateScope
          Predicates as input.
 int nStartingRule
          Number of rules that only contains evidence relations.
 java.util.HashSet<FelixPredicate> outputPredicates
          Predicates output by this bucket.
 int precedence
          Precedence of this bucket.
 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 addCommonOutput(FelixPredicate _fp)
          Adds predicate to dd_CommonOutput.
 void addMLNRelTable(java.lang.String tableName)
          Register a table in subTuffyMLNRelTable.
 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(tuffy.db.RDB db, java.lang.String fout, FelixPredicate p)
          Deprecated.  
 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()
          Deprecated.  
 void prepareDB44DD()
          Prepares database for dual decomposition -- 1) add new rules for Lagaragian Multipliers; 2) create tables for intermediate output and priors etc..
 void pushPredicateScopes(java.util.HashSet<FelixPredicate> _predicates)
          Deprecated.  
 void run()
          Run all operators in this bucket.
 void runNextOperatorInBucket()
          Deprecated.  
 void setNCore(int _nCore)
          Set the degree of concurrency.
 java.lang.String toNoParString()
          Returns string representation of bucket without partitioning info..
 java.lang.String toString()
          Returns string representation of bucket.
 
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inputPredicates

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


cleared

public java.util.HashSet<java.lang.String> cleared
Auxiliary structure for clearing the old data table and merge the output of statistical operators in this bucket. This is used for not clearing a table twice.


commonCandidates

public java.util.HashSet<FelixPredicate> commonCandidates
Set of predicates that can potentially share with others (through dual decomposition).


outputPredicates

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


inputPredicateScope

public java.util.HashSet<java.lang.String> inputPredicateScope
Predicates as input.


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.


nStartingRule

public int nStartingRule
Number of rules that only contains evidence relations. Intuitively, the larger this number, the earlier we should solve it while scheduling.


dd_CommonOutput

public java.util.HashSet<FelixPredicate> dd_CommonOutput
Relations that are shared with other buckets through dual decomposition.


dd_commonOutputPredicate_2_tableName

public java.util.HashMap<FelixPredicate,java.lang.String> dd_commonOutputPredicate_2_tableName
Map from relations in dd_CommonOutput to tables containing their temporary output result in each iteration.


dd_commonOutputPredicate_2_priorTableName

public java.util.HashMap<FelixPredicate,java.lang.String> dd_commonOutputPredicate_2_priorTableName
Map from relations in dd_CommonOutput to tables containing their corresponding Langragian Multipliers.

Constructor Detail

ConcurrentOperatorsBucket

public ConcurrentOperatorsBucket(boolean isMarginal)
The constructor.

Parameters:
isMarginal -
Method Detail

addMLNRelTable

public void addMLNRelTable(java.lang.String tableName)
Register a table in subTuffyMLNRelTable.

Parameters:
tableName -

pushPredicateScopes

public void pushPredicateScopes(java.util.HashSet<FelixPredicate> _predicates)
Deprecated. 

Adds input predicate scopes.

Parameters:
_predicates -

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 -

addCommonOutput

public void addCommonOutput(FelixPredicate _fp)
Adds predicate to dd_CommonOutput.

Parameters:
_fp -

prepareDB44DD

public void prepareDB44DD()
Prepares database for dual decomposition -- 1) add new rules for Lagaragian Multipliers; 2) create tables for intermediate output and priors etc..


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()
Deprecated. 

Run the next operator in this bucket.


myJoin

public void myJoin()
Deprecated. 

Return only if all the operators have been executed.


toString

public java.lang.String toString()
Returns string representation of bucket.

Overrides:
toString in class java.lang.Thread

toNoParString

public java.lang.String toNoParString()
Returns string representation of bucket without partitioning info..

Returns:

dumpMapAnswerForPredicate

public void dumpMapAnswerForPredicate(tuffy.db.RDB db,
                                      java.lang.String fout,
                                      FelixPredicate p)
Deprecated. 

Output the results of this bucket.

Parameters:
db -
fout -
p -