ETRelationalCache Class Reference

This class represents a cache node, which can be added on top of another ETRelationalExpr node. More...

Inherits Simba::SQLEngine::ETUnaryRelationalExpr.

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.
 ETRelationalCache (AutoPtr< ETRelationalExpr > in_operand, AutoPtr< Simba::DSI::IColumns > in_columns, const DSIExtExecutorContext &in_execContext, bool in_shouldCompress)
 Constructor.
virtual simba_uint16 GetColumnCount ()
 Returns the number of columns that this relation has.
virtual simba_wstring GetLogString () const
 This method returns a string name for this node for the purpose of logging. It is designed to be convenient rather than efficient.
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 ~ETRelationalCache ()
 Destructor.

Detailed Description

This class represents a cache node, which can be added on top of another ETRelationalExpr node.

A cache node handles the mechanism for caching any result rows from the execution of its ETRelationalExpr node.

The ETRelationalCache base node type is ETRelationalExpr so that it can be added without disrupting the structure of the ETree.

Example usage: An AESubQuery node that is non-correlated should be materialized with an ETRelationalCache node. This is because, we only want to execute the sub-query once and cache the result rows. A correlated sub-query should not be cached as it needs to be executed every time Move() is called on its parent node.

A non-correlated sub-query is materialized as an ETRelationalCache node with a child ETRelationalExpr. See ETSubQuery for information about the materialization of correlated subqueries.


Constructor & Destructor Documentation

ETRelationalCache ( AutoPtr< ETRelationalExpr in_operand,
AutoPtr< Simba::DSI::IColumns in_columns,
const DSIExtExecutorContext in_execContext,
bool  in_shouldCompress 
)

Constructor.

Parameters:
in_operand The ETRelationalExpr node for which to add this ETRelationalCache node on top of.
in_columns The columns of in_operand. (OWN)
in_execContext The query specific executor context. retrieval has been canceled.
in_shouldCompress If this cache should use compression.
virtual ~ETRelationalCache (  )  [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 simba_uint16 GetColumnCount (  )  [virtual]

Returns the number of columns that this relation has.

Returns:
The number of columns.

Implements ETRelationalExpr.

virtual simba_wstring GetLogString (  )  const [virtual]

This method returns a string name for this node for the purpose of logging. It is designed to be convenient rather than efficient.

Returns:
a string representation of this 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:
node type identifier

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. ETRelationalCache 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.

This node opens its operand (a sub-query), executes it, and then caches the result rows.

Parameters:
in_cursorType The cursor type.
Exceptions:
SEInvalidArgumentException when in_cursorType is invalid or not supported.

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.


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