com.metamatrix.query.processor.relational
Class RelationalNode

java.lang.Object
  extended by com.metamatrix.query.processor.relational.RelationalNode
All Implemented Interfaces:
Describable, java.lang.Cloneable
Direct Known Subclasses:
AccessNode, BatchedUpdateNode, GroupingNode, LimitNode, NullNode, PlanExecutionNode, ProjectIntoNode, SortNode, SubqueryAwareRelationalNode, UnionAllNode

public abstract class RelationalNode
extends java.lang.Object
implements java.lang.Cloneable, Describable


Field Summary
 
Fields inherited from interface com.metamatrix.query.processor.Describable
PROP_BINDINGS, PROP_CHILDREN, PROP_CONDITIONS, PROP_CRITERIA, PROP_DATA_COL, PROP_DEFAULT, PROP_DEFAULT_PROGRAM, PROP_ELSE, PROP_ENCODING, PROP_EXECUTION_PLAN, PROP_EXPRESSION, PROP_FORMATTED, PROP_GROUP, PROP_GROUP_COLS, PROP_IN_MEMORY, PROP_INTO_GROUP, PROP_IS_STAGING, PROP_JOIN_CRITERIA, PROP_JOIN_STRATEGY, PROP_JOIN_TYPE, PROP_MESSAGE, PROP_MODEL_NAME, PROP_NAMESPACE, PROP_NAMESPACE_DECL, PROP_NODE_COST_ESTIMATES, PROP_NODE_STATS_LIST, PROP_NODE_STATS_PROPS, PROP_OPTIONAL, PROP_OUTPUT_COLS, PROP_PROGRAM, PROP_PROGRAMS, PROP_RECURSE_DIR, PROP_REMOVE_DUPS, PROP_RESULT_SET, PROP_ROW_LIMIT, PROP_ROW_OFFSET, PROP_SELECT_COLS, PROP_SORT_COLS, PROP_SQL, PROP_TAG, PROP_THEN, PROP_TYPE, PROP_VARIABLE
 
Constructor Summary
RelationalNode(int nodeID)
           
 
Method Summary
protected  void addBatchRow(java.util.List row)
           
 void addChild(RelationalNode child)
           
abstract  java.lang.Object clone()
          All the implementation of Cloneable interface need to implement clone() method.
 void close()
           
protected  void copy(RelationalNode source, RelationalNode target)
           
protected  java.util.Map createLookupMap(java.util.List elements)
          Useful function to build an element lookup map from an element list.
protected  int getBatchSize()
           
protected  BufferManager getBufferManager()
           
protected  java.util.List getChildDescriptionProperties()
           
 java.util.List getChildPlans()
          Find all ProcessorPlans used by this node.
 RelationalNode[] getChildren()
           
protected  java.lang.String getClassName()
          Helper for the toString to get the class name from the full class name.
protected  java.lang.String getConnectionID()
           
 CommandContext getContext()
           
protected  ProcessorDataManager getDataManager()
           
 java.util.Map getDescriptionProperties()
          Get a description as a set of properties of primitive types such as String, Integer, etc.
 java.util.List getElements()
           
 java.lang.Number getEstimateNodeCardinality()
           
 int getID()
           
 java.util.Collection<? extends LanguageObject> getLanguageObjects()
           
 RelationalNodeStatistics getNodeStatistics()
           
protected  void getNodeString(java.lang.StringBuffer str)
           
 RelationalNode getParent()
           
protected  boolean hasPendingRows()
           
 void initialize(CommandContext context, BufferManager bufferManager, ProcessorDataManager dataMgr)
           
protected  boolean isBatchFull()
           
 boolean isClosed()
          Check if the node has been already closed
 TupleBatch nextBatch()
          Wrapper for nextBatchDirect that does performance timing - callers should always call this rather than nextBatchDirect().
protected abstract  TupleBatch nextBatchDirect()
          Template method for subclasses to implement.
 java.lang.String nodeToString()
          Just print single node to string instead of node+recursive plan.
 void open()
           
protected  java.util.List projectTuple(java.util.Map tupleElements, java.util.List tupleValues, java.util.List projectElements)
          Helper method for all the node that will filter the elements needed for the next node.
protected  TupleBatch pullBatch()
           
 void reset()
           
 void setContext(CommandContext context)
           
 void setElements(java.util.List elements)
           
 void setEstimateDepAccessCardinality(java.lang.Number depAccessEstimate)
           
 void setEstimateDepJoinCost(java.lang.Number estimateDepJoinCost)
           
 void setEstimateJoinCost(java.lang.Number estimateJoinCost)
           
 void setEstimateNodeCardinality(java.lang.Number estimateNodeCardinality)
           
 void setEstimateNodeSetSize(java.lang.Number setSizeEstimate)
           
 void setID(int nodeID)
           
 void setParent(RelationalNode parent)
           
protected  void terminateBatches()
           
 java.lang.String toString()
          Print plantree structure starting at this node
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RelationalNode

public RelationalNode(int nodeID)
Method Detail

setContext

public void setContext(CommandContext context)

initialize

public void initialize(CommandContext context,
                       BufferManager bufferManager,
                       ProcessorDataManager dataMgr)

getContext

public CommandContext getContext()

getID

public int getID()

setID

public void setID(int nodeID)

getBufferManager

protected BufferManager getBufferManager()

getDataManager

protected ProcessorDataManager getDataManager()

getConnectionID

protected java.lang.String getConnectionID()

getBatchSize

protected int getBatchSize()

reset

public void reset()

setElements

public void setElements(java.util.List elements)

getElements

public java.util.List getElements()

getParent

public RelationalNode getParent()

setParent

public void setParent(RelationalNode parent)

getChildren

public RelationalNode[] getChildren()

addChild

public void addChild(RelationalNode child)

addBatchRow

protected void addBatchRow(java.util.List row)

terminateBatches

protected void terminateBatches()

isBatchFull

protected boolean isBatchFull()

hasPendingRows

protected boolean hasPendingRows()

pullBatch

protected TupleBatch pullBatch()

open

public void open()
          throws MetaMatrixComponentException,
                 MetaMatrixProcessingException
Throws:
MetaMatrixComponentException
MetaMatrixProcessingException

nextBatch

public TupleBatch nextBatch()
                     throws BlockedException,
                            MetaMatrixComponentException,
                            MetaMatrixProcessingException
Wrapper for nextBatchDirect that does performance timing - callers should always call this rather than nextBatchDirect().

Returns:
Throws:
BlockedException
MetaMatrixComponentException
MetaMatrixProcessingException
Since:
4.2

nextBatchDirect

protected abstract TupleBatch nextBatchDirect()
                                       throws BlockedException,
                                              MetaMatrixComponentException,
                                              MetaMatrixProcessingException
Template method for subclasses to implement.

Returns:
Throws:
BlockedException
MetaMatrixComponentException
MetaMatrixProcessingException - if exception related to user input occured
Since:
4.2

close

public void close()
           throws MetaMatrixComponentException
Throws:
MetaMatrixComponentException

isClosed

public boolean isClosed()
Check if the node has been already closed

Returns:

projectTuple

protected java.util.List projectTuple(java.util.Map tupleElements,
                                      java.util.List tupleValues,
                                      java.util.List projectElements)
                               throws MetaMatrixComponentException
Helper method for all the node that will filter the elements needed for the next node.

Throws:
MetaMatrixComponentException

createLookupMap

protected java.util.Map createLookupMap(java.util.List elements)
Useful function to build an element lookup map from an element list.

Parameters:
elements - List of elements
Returns:
Map of element to Integer, which is the index

toString

public java.lang.String toString()
Print plantree structure starting at this node

Overrides:
toString in class java.lang.Object
Returns:
String representing this node and all children under this node

nodeToString

public java.lang.String nodeToString()
Just print single node to string instead of node+recursive plan.

Returns:
String representing just this node

getNodeString

protected void getNodeString(java.lang.StringBuffer str)

getClassName

protected java.lang.String getClassName()
Helper for the toString to get the class name from the full class name.

Parameters:
fullClassName - Fully qualified class name
Returns:
Just the last part which is the class name

clone

public abstract java.lang.Object clone()
All the implementation of Cloneable interface need to implement clone() method. The plan is only clonable in the pre-execution stage, not the execution state (things like program state, result sets, etc). It's only safe to call that method in between query processings, in other words, it's only safe to call clone() on a plan after nextTuple() returns null, meaning the plan has finished processing.

Overrides:
clone in class java.lang.Object

copy

protected void copy(RelationalNode source,
                    RelationalNode target)

getChildPlans

public java.util.List getChildPlans()
Find all ProcessorPlans used by this node. If no plans are used, null may be returned. The default implementation will return null.

Returns:
List of ProcessorPlan or null if none
Since:
4.2

getLanguageObjects

public java.util.Collection<? extends LanguageObject> getLanguageObjects()

getDescriptionProperties

public java.util.Map getDescriptionProperties()
Description copied from interface: Describable
Get a description as a set of properties of primitive types such as String, Integer, etc.

Specified by:
getDescriptionProperties in interface Describable
Returns:
Map of properties

getChildDescriptionProperties

protected java.util.List getChildDescriptionProperties()

getNodeStatistics

public RelationalNodeStatistics getNodeStatistics()
Returns:
Returns the nodeStatistics.
Since:
4.2

setEstimateNodeCardinality

public void setEstimateNodeCardinality(java.lang.Number estimateNodeCardinality)

setEstimateNodeSetSize

public void setEstimateNodeSetSize(java.lang.Number setSizeEstimate)

setEstimateDepAccessCardinality

public void setEstimateDepAccessCardinality(java.lang.Number depAccessEstimate)

setEstimateDepJoinCost

public void setEstimateDepJoinCost(java.lang.Number estimateDepJoinCost)

setEstimateJoinCost

public void setEstimateJoinCost(java.lang.Number estimateJoinCost)

getEstimateNodeCardinality

public java.lang.Number getEstimateNodeCardinality()
Returns:
Returns the estimateNodeCardinality.


Copyright © 2009. All Rights Reserved.