org.teiid.query.processor.relational
Class RelationalNode

java.lang.Object
  extended by org.teiid.query.processor.relational.RelationalNode
All Implemented Interfaces:
java.lang.Cloneable, BatchCollector.BatchProducer
Direct Known Subclasses:
GroupingNode, LimitNode, NullNode, PlanExecutionNode, ProjectIntoNode, SortNode, SubqueryAwareRelationalNode, UnionAllNode

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


Constructor Summary
protected RelationalNode()
           
  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()
           
 void closeDirect()
           
protected  void copy(RelationalNode source, RelationalNode target)
           
static 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()
           
 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()
           
 PlanNode getDescriptionProperties()
           
 java.util.List getElements()
           
 java.lang.Number getEstimateNodeCardinality()
           
 int getID()
           
 RelationalNodeStatistics getNodeStatistics()
           
protected  void getNodeString(java.lang.StringBuffer str)
           
 java.util.List getOutputElements()
          Get list of resolved elements describing output columns for this plan.
 RelationalNode getParent()
           
static int[] getProjectionIndexes(java.util.Map<SingleElementSymbol,java.lang.Integer> tupleElements, java.util.List<? extends Expression> projectElements)
          Helper method for all the node that will filter the elements needed for the next node.
protected  boolean hasPendingRows()
           
 void initialize(CommandContext context, BufferManager bufferManager, ProcessorDataManager dataMgr)
           
protected  boolean isBatchFull()
           
 boolean isClosed()
          Check if the node has been already closed
 boolean isLastBatch()
           
 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()
           
static java.util.List<?> projectTuple(int[] indexes, java.util.List<?> tupleValues)
           
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

protected RelationalNode()

RelationalNode

public RelationalNode(int nodeID)
Method Detail

isLastBatch

public boolean isLastBatch()

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)

getOutputElements

public java.util.List getOutputElements()
Description copied from interface: BatchCollector.BatchProducer
Get list of resolved elements describing output columns for this plan.

Specified by:
getOutputElements in interface BatchCollector.BatchProducer
Returns:
List of SingleElementSymbol

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 TeiidComponentException,
                 TeiidProcessingException
Throws:
TeiidComponentException
TeiidProcessingException

nextBatch

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

Specified by:
nextBatch in interface BatchCollector.BatchProducer
Returns:
Throws:
BlockedException
TeiidComponentException
TeiidProcessingException - for business rule exception, related to user input or modeling
Since:
4.2

nextBatchDirect

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

Returns:
Throws:
BlockedException
TeiidComponentException
TeiidProcessingException - if exception related to user input occured
Since:
4.2

close

public final void close()
                 throws TeiidComponentException
Throws:
TeiidComponentException

closeDirect

public void closeDirect()

isClosed

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

Returns:

getProjectionIndexes

public static int[] getProjectionIndexes(java.util.Map<SingleElementSymbol,java.lang.Integer> tupleElements,
                                         java.util.List<? extends Expression> projectElements)
Helper method for all the node that will filter the elements needed for the next node.


projectTuple

public static java.util.List<?> projectTuple(int[] indexes,
                                             java.util.List<?> tupleValues)

createLookupMap

public static 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)

getDescriptionProperties

public PlanNode getDescriptionProperties()

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 © 2010. All Rights Reserved.