#include <IQueryOperator.h>
Inherited by IScanOperator, and ProjectOperator.
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. |
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 should feel free to change it as you see fit. See also the extended version of the interface, IScanOperator, intended for use with record file scans and index scans.
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.
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 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 ReturnCode IQueryOperator::getNextRecord | ( | Record * | record | ) | [pure virtual] |
Gets the next record.
record | Record object to hold the returned record |
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 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 void IQueryOperator::getSchema | ( | RelationAttributeInfo | attributes[] | ) | [pure virtual] |
Gets the list of attributes of this operator.
attributes | The list of attributes to be filled in |
Implemented in FileScanOperator, and ProjectOperator.
virtual void IQueryOperator::printSubtree | ( | int | indent | ) | [pure virtual] |
Prints this operator and its subtree.
indent | The level of indentation |
Implemented in FileScanOperator, and ProjectOperator.