ETInnerJoin Class Reference

This class models the derived join relational operation: Join(R1, R2, Cond), where "Cond" is the join condition. More...

Inherits Simba::SQLEngine::ETJoin.

List of all members.

Public Member Functions

virtual void AcceptVisitor (ETNodeVisitor *in_visitor)
 Calls the correct method on the visitor.
virtual void Close ()
 Close the node to disallow execution. Once closed, IsOpen() returns false.
virtual void DisableCacheSelectivelyInSubtree ()
 Disable the caching optimization in this sub-tree.
 ETInnerJoin (AutoPtr< ETRelationalExpr > in_leftOperand, AutoPtr< ETRelationalExpr > in_rightOperand, AutoPtr< ETBooleanExpr > in_joinCondition)
 Constructor.
virtual Simba::DSI::IColumnGetColumn (simba_uint16 in_column)
 Gets a column of the relational expression.
virtual simba_uint16 GetColumnCount ()
 Returns the number of columns that this relation has.
ETBooleanExprGetJoinCond ()
 Get a reference to the join condition.
virtual simba_wstring GetLogString () const
 This method returns a string name for this node for the purpose of logging.
virtual ETNodeType GetNodeType () const
virtual bool GetRowCount (simba_uint64 &out_rowCount)
 Get the number of rows in the relation if it is available.
virtual bool IsOffsetSupported ()
virtual bool IsOpen ()
 Test whether the node is already opened for execution.
virtual void Open (Simba::DSI::DSICursorType in_cursorType)
 Open the node for execution.
virtual void Reset ()
virtual bool RetrieveData (simba_uint16 in_column, ETDataRequest &io_dataRequest)
 Fetch the specified column from the current row (if there is a current row) into the given ETDataRequest object.
virtual ~ETInnerJoin ()
 Destructor.

Protected Attributes

AutoPtr< ETBooleanExprm_joinCondition
simba_uint16 m_leftOperandColCount
bool m_shouldMoveLeft

Detailed Description

This class models the derived join relational operation: Join(R1, R2, Cond), where "Cond" is the join condition.

This join is often known as Theta-Join in relational algebra. Although this relational operation is equivalent to sf(R1 � R2), we chose to model this relation directly as it appears so often. The execution component can choose to implement this operation directly or in terms of select and cross join operations.


Constructor & Destructor Documentation

ETInnerJoin ( AutoPtr< ETRelationalExpr in_leftOperand,
AutoPtr< ETRelationalExpr in_rightOperand,
AutoPtr< ETBooleanExpr in_joinCondition 
)

Constructor.

Parameters:
in_leftOperand The left relational expression. (OWN)
in_rightOperand The right relational expression. (OWN)
in_joinCondition The join condition on the two relations. (OWN)
Exceptions:
SEInvalidArgumentException when any of the arguments does not contain a required object.
virtual ~ETInnerJoin (  )  [virtual]

Destructor.


Member Function Documentation

virtual void AcceptVisitor ( ETNodeVisitor *  in_visitor  )  [virtual]

Calls the correct method on the visitor.

Parameters:
in_visitor The visitor object. (NOT OWN)

Implements ETNode.

virtual void Close (  )  [virtual]

Close the node to disallow execution. Once closed, IsOpen() returns false.

NOTE: If the node is not already open, this method will _not_ throw an exception.

Implements ETExpr.

virtual void DisableCacheSelectivelyInSubtree (  )  [virtual]

Disable the caching optimization in this sub-tree.

This will disable caching for any ETCachedTables, however it will not disable caching for any objects which need caching to function (ETSort, ETDistinct, etc). It will also leave caching enabled for any child join nodes and leave it to them to disabled caching for their children if necessary.

This is necessary because in some cases, ETCachedTables will be created when they are not needed, as the information that they are not needed is not yet available. In these cases, disable the needless caching to avoid wasting memory/CPU cycles.

Reimplemented from ETRelationalExpr.

virtual Simba::DSI::IColumn* GetColumn ( simba_uint16  in_column  )  [virtual]

Gets a column of the relational expression.

The default implementation here always throws an exception.

Parameters:
in_column A zero-based column index.
Exceptions:
SEInvalidArgumentException if in_column is invalid.
SEInvalidOperationException if the expression does not support this method.
Returns:
A pointer to a column of the relational expression. (NOT OWN)

Reimplemented from ETRelationalExpr.

virtual simba_uint16 GetColumnCount (  )  [virtual]

Returns the number of columns that this relation has.

Returns:
The number of columns.

Implements ETRelationalExpr.

ETBooleanExpr* GetJoinCond (  ) 

Get a reference to the join condition.

Returns:
a pointer reference to the join condition. (NOT OWN)
virtual simba_wstring GetLogString (  )  const [virtual]

This method returns a string name for this node for the purpose of logging.

Returns:
a string representation of the node

Implements ETNode.

virtual ETNodeType GetNodeType (  )  const [virtual]

Return an integer that uniquely identifies the node class. See the definition of ETNodeType for values defined.

Returns:
the node type

Implements ETNode.

virtual bool GetRowCount ( simba_uint64 &  out_rowCount  )  [virtual]

Get the number of rows in the relation if it is available.

Whether the number of rows in the relation is known mainly depends on two factors,

1. Whether the input relation provides the information. 2. The actual relational expression type.

For example, A SORT relational operator should always have this information regardless whether the input relation provides the information since it has to fetch all rows on Open().

Another example, A PROJECT relational operator will know the row count only if the input relation can provide its row count.

Parameters:
out_rowCount If the rowcount is known, it will be put into here.
Returns:
Whether the rowcount is known (and thus whether out_rowCount is valid)

Implements ETRelationalExpr.

virtual bool IsOffsetSupported (  )  [virtual]

Indicate whether fetching offset is supported in the Move(...) method. ETTable supports an offset if the underlying DSIExtResultSet supports an offset.

This method is designed for optimization. Although SimbaEngine could support fetch offset even the underlying data store does not support it, it is more efficient if the data store supports it directly in certain situations such as the following,

  • Simple fetching everything from a table (i.e., SELECT * FROM T)
  • Fetching a subset of columns without filtering (i.e., SELECT C1,C2 FROM T)

The execution tree nodes will take this into consideration and forward the information to the DSII.

Returns:
True if supports fetch offset; false otherwise.

Implements ETRelationalExpr.

virtual bool IsOpen (  )  [virtual]

Test whether the node is already opened for execution.

Returns:
True if the node is open; false otherwise.

Implements ETExpr.

virtual void Open ( Simba::DSI::DSICursorType  in_cursorType  )  [virtual]

Open the node for execution.

For different node type, the meaning of "open" might be very different.

  • For a Sort node, this means the sorting of the whole input stream.
  • For an uncorrelated sub-query in an expression, this means the execution of the sub-query. The reason is that the sub-query needs to be executed only once and it is best done at the node "open" time.
  • For most of the expression nodes, this normally means preparing the operands. (i.e., call the Open() methods on the operands.)
Parameters:
in_cursorType The cursor type.
Exceptions:
SEInvalidArgumentException when in_cursorType is invalid or not supported
SESqlErrorException for any other errors.

Implements ETRelationalExpr.

virtual void Reset (  )  [virtual]

Reset the cursor position to where it initially starts. Depending on the cursor type, this may not applicable.

Exceptions:
SEInvalidOperationException when this operation is not supported by the current cursor.

Implements ETRelationalExpr.

virtual bool RetrieveData ( simba_uint16  in_column,
ETDataRequest io_dataRequest 
) [virtual]

Fetch the specified column from the current row (if there is a current row) into the given ETDataRequest object.

See also:
ETDataRequest for the procedure that all data retrieval methods must follow. The class also documented what io_dataRequest contains after the method returns.
Parameters:
in_column A zero-based column index.
io_dataRequest Holds a buffer and other information for data retrieval.
Exceptions:
SEInvalidOperationException when the node is closed.
Returns:
true if there is more data left, false otherwise.

Implements ETRelationalExpr.


Member Data Documentation

simba_uint16 m_leftOperandColCount [protected]
bool m_shouldMoveLeft [protected]

The documentation for this class was generated from the following file:

Generated on Wed May 17 14:21:18 2017 for SimbaEngine 10.1.3.1011 by simba