IQueryOperator Class Reference

Basic interface for a query operator. More...

#include <IQueryOperator.h>

Inherited by FileScanOperator, and ProjectOperator.

List of all members.

Public Member Functions

virtual ReturnCode openExecution ()=0
 Notifies the operator that query execution is about to begin.
virtual ReturnCode closeExecution ()=0
 Notifies the operator that query execution has completed.
virtual ReturnCode getNextRecord (Record *record)=0
 Gets the next record.
virtual int getArity ()=0
 Gets the number of attributes of this operator.
virtual void getSchema (RelationAttributeInfo attributes[])=0
 Gets the list of attributes of this operator.
virtual void printSubtree (int indent)=0
 Prints this operator and its subtree.
virtual ~IQueryOperator ()
 Destructor for IQueryOperator.

Detailed Description

Basic interface for a query operator.

Basic interface for a query operator, to give you a starting point in your query engine design. It supports a pipelined evaluation model, where tuples are "pulled" through the pipeline via calls to IQueryOperator::getNextRecord. Two other provided classes, FileScanOperator and ProjectOperator, implement IQueryOperator. You are not required to use this interface, and you are free to change it as you see necessary. As mentioned in lecture, even if you do use a query evaluation architecture based on IQueryOperator, you will probably need to add additional methods, or create new interfaces extending (inheriting from) IQueryOperator in order to implement functionality such as a generic approach to nested loops join.


Constructor & Destructor Documentation

virtual IQueryOperator::~IQueryOperator (  )  [inline, virtual]

Destructor for IQueryOperator.

Destructor for IQueryOperator, declared virtual to ensure that the inherited class destructor is called for implementations. To delete a query plan after execution, the expectation is that QueryEngine will simply delete the root node, and the deletion of the full tree will be carried out recursively, with each operator's destructor responsible for deleting its children.


Member Function Documentation

virtual ReturnCode IQueryOperator::closeExecution (  )  [pure virtual]

Notifies the operator that query execution has completed.

This method is intended to be invoked once, after the last invocation of getNextRecord, to signal to the operator that query execution has completed (so that any necessary cleanup can be performed). The operator should call closeExecution on any children when this method is invoked, even if it does nothing else.

Implemented in FileScanOperator, and ProjectOperator.

virtual int IQueryOperator::getArity (  )  [pure virtual]

Gets the number of attributes of this operator.

Returns the number of attributes in records returned by this operator

Implemented in FileScanOperator, and ProjectOperator.

virtual ReturnCode IQueryOperator::getNextRecord ( Record record  )  [pure virtual]

Gets the next record.

Parameters:
record Record object to hold the returned record

This method is called each time the parent operator requires another record. The intention is that at the top level, QueryEngine invokes getNextRecord repeatedly on the root operator in the tree to retrieve the answers to a query. Each operator will in turn call getNextRecord on its children, while performing whatever operator-specific processing of those records is required. At the bottom of the tree, file scan or index scan operators return records from disk in their getNextRecord implementations. Returns RC_OK on success, RC_EOF if there are no more records, and other RC error codes otherwise.

The record parameter is managed by the caller, who must ensure that it is the right size returned records. (The buffer must be at least recordSize in length, where recordSize is the sum of the lengths of the attributes of this operator.)

The rationale for using a Record object, rather than simply a data buffer, is to support query plans involving updates (where the operator at the top of the execution plan needs to know the RecordID of a record matching the specified selection conditions). Unary operators, such as projection and selection, should probably preserve the RecordID of tuples passing up through them. For binary operators such as join, the returned RecordID is not meaningful and may be arbitrary.

Implemented in FileScanOperator, and ProjectOperator.

virtual void IQueryOperator::getSchema ( RelationAttributeInfo  attributes[]  )  [pure virtual]

Gets the list of attributes of this operator.

Parameters:
attributes The list of attributes to be filled in

Gets the list of attributes of this operator. The attributes array is managed by the caller and must be of length equal to getArity().

Implemented in FileScanOperator, and ProjectOperator.

virtual ReturnCode IQueryOperator::openExecution (  )  [pure virtual]

Notifies the operator that query execution is about to begin.

This method is intended to be invoked once, before the first invocation of getNextRecord, to give the operator implementation a chance to perform any necessary initialization before query execution gets underway. The operator should call openExecution on any children when this method is invoked, even if it does nothing else. Returns RC_OK on success, and other error codes on failure.

Implemented in FileScanOperator, and ProjectOperator.

virtual void IQueryOperator::printSubtree ( int  indent  )  [pure virtual]

Prints this operator and its subtree.

Parameters:
indent The level of indentation

Prints this operator and its subtree to standard output. This method is intended to support pretty-printing of query plans to the console, as discussed in the documentation for QueryEngine::select, QueryEngine::remove, and QueryEngine::update.

Implemented in FileScanOperator, and ProjectOperator.


The documentation for this class was generated from the following file:
Generated on Sun May 16 23:18:41 2010 for DavisDB by  doxygen 1.6.3