uk.org.ogsadai.dqp.lqp
Interface Operator

All Superinterfaces:
Annotatable
All Known Subinterfaces:
ScanOperator
All Known Implementing Classes:
AbstractJoinOperator, AbstractOperator, AntiSemiJoinOperator, ApplyOperator, BinaryOperator, BinaryRelFunctionOperator, DifferenceOperator, DuplicateEliminationOperator, ExchangeOperator, FilteredTableScanOperator, FullOuterJoinOperator, GroupByOperator, InnerThetaJoinOperator, IntersectionOperator, LeftOuterJoinOperator, LimitOperator, NilOperator, OneRowOnlyOperator, OuterUnionOperator, ProductOperator, ProjectOperator, PullExchangeConsumerOperator, PullExchangeProducerOperator, PushExchangeConsumerOperator, PushExchangeProducerOperator, QueryApplyOperator, RenameOperator, RightOuterJoinOperator, ScalarGroupByOperator, ScanBindApplyOperator, ScanRelFunctionOperator, SelectOperator, SemiJoinOperator, SetOperator, SortOperator, TableScanOperator, UnaryOperator, UnaryRelFunctionOperator, UnionOperator

public interface Operator
extends Annotatable

Operator interface.

Author:
The OGSA-DAI Project Team.

Method Summary
 void accept(OperatorVisitor visitor)
          Accepts operator visitor.
 void disconnect()
          Disconnects operator.
 Operator getChild(int position)
          Gets child at the specified position.
 int getChildCount()
          Gets the number of children the operator has.
 Heading getHeading()
          Gets operator heading.
 OperatorID getID()
          Gets operator id.
 Operator getParent()
          Returns the parent operator.
 long getResultCardinality()
          Returns the value of the result.cardinality operator annotation or calculates a new estimate.
 java.util.Set<Attribute> getUsedAttributes()
          Gets a set of attributes required by the operator.
 boolean isBinary()
          Indicates if operator is binary.
 boolean isPartitionLeaf()
          Returns true if this operator marks the leaf of a partition and any children it has will be in a different partition.
 void renameUsedAttributes(RenameMap renameMap)
          Rename attributes From -> To as defined in a map.
 void replaceChild(Operator currentChild, Operator newChild)
          Replaces the current child with a new child.
 void setChild(int position, Operator child)
          Sets operator child at a given position.
 void setParent(Operator parent)
          Sets the parent operator.
 void update()
          Operator forwards the update call to its children and updates itself.
 void validate()
          Operator forwards the validation call to its children and validates itself.
 
Methods inherited from interface uk.org.ogsadai.dqp.lqp.Annotatable
addAnnotation, getAnnotation, getAnnotations, removeAnnotation
 

Method Detail

getParent

Operator getParent()
Returns the parent operator.

Returns:
parent operator or null if not connected.

setParent

void setParent(Operator parent)
Sets the parent operator.

Parameters:
parent - parent operator

getChild

Operator getChild(int position)
Gets child at the specified position. Position numbering starts from 0.

Parameters:
position - child position
Returns:
child at a given position

getChildCount

int getChildCount()
Gets the number of children the operator has.

Returns:
the number of children the operator has.

setChild

void setChild(int position,
              Operator child)
Sets operator child at a given position. Child's parent is also set accordingly by this call.

Parameters:
position - operator position
child - child operator

replaceChild

void replaceChild(Operator currentChild,
                  Operator newChild)
Replaces the current child with a new child. Sets parent of the replaced child to null.

Parameters:
currentChild - child to be replaced
newChild - replacement

getID

OperatorID getID()
Gets operator id.

Returns:
operator id

isPartitionLeaf

boolean isPartitionLeaf()
Returns true if this operator marks the leaf of a partition and any children it has will be in a different partition. Exchange consumer operators must return true here, other operators must return false.

Returns:
true if this is a partition leaf, false otherwise.

isBinary

boolean isBinary()
Indicates if operator is binary.

Returns:
true if operator is binary, false otherwise

validate

void validate()
              throws LQPException
Operator forwards the validation call to its children and validates itself. Validation depends on operator logic. This usually involves (but is not limited to) checking if all attributes required to perform operator logic are in children's headings.

Throws:
LQPException - when validation fails

update

void update()
            throws LQPException
Operator forwards the update call to its children and updates itself. Operators must be updated after each change of their children. Update usually involves (but is not limited to) rebuilding the operator heading.

Throws:
LQPException - when update fails

getHeading

Heading getHeading()
Gets operator heading.

Returns:
operator heading

disconnect

void disconnect()
Disconnects operator. Sets relevant references to null. Disconnected operator is not referring to any other operators. However, children and parent may still refer to the disconnected operator.


getResultCardinality

long getResultCardinality()
Returns the value of the result.cardinality operator annotation or calculates a new estimate.

Returns:
estimated results cardinality

getUsedAttributes

java.util.Set<Attribute> getUsedAttributes()
Gets a set of attributes required by the operator.

Returns:
set of all the attributes used by the operator.

renameUsedAttributes

void renameUsedAttributes(RenameMap renameMap)
                          throws LQPException
Rename attributes From -> To as defined in a map.

Parameters:
renameMap - rename map
Throws:
LQPException - when rename is impossible

accept

void accept(OperatorVisitor visitor)
Accepts operator visitor.

Parameters:
visitor - visitor object