In file relplanop.h:

class RelSMPlanOp : public RelSPJPlanOp

The Sort-merge Join plan operator

Inheritance:


Public Methods

virtual XxxErrCode CloseHandle (XxxDerivedRelation::CursorInfo* Handle, XxxRelation* *RelationArray)
Closes the scan this plan operator offers
virtual XxxErrCode GetNextRecord (XxxSetCursor& SCsr, XxxRelation* *RelationArray, const XxxRecordSchema* Schema, XxxRecord*& ReturnRec)
Gets the next record from this plan operator
virtual XxxErrCode InitHandle (XxxDerivedRelation::CursorInfo* Handle, XxxRelation* *RelationArray)
Initializes this plan operator
virtual const char* PrintString ()
Returns a string representation of this plan operator
RelSMPlanOp (int NumChildren, RelPlanOp* Children[], RelCatalogInfo* CatInfo, XxxValExprPlanList* ExprPlanList, XxxBooleanExpressionPlan** SelPredPlans, XxxBooleanExpressionPlan** JoinPredPlans, XxxBooleanExpressionPlan** ResidPredPlans, XxxBooleanExpressionPlan* InitPlan)
Constructor
virtual ~RelSMPlanOp ()
Destructor

Protected Classes

class Group
Encapsulates the concept of a record group; maintains a linked- list of records and information on which attribute the join is based upon
struct Member
The linked-list node structure
Member* members
The head of the linked list
Member* currentMember
The cursor in scans
int attrIndex
The attribute of the records in the equality join condition
XxxBool scanValid
Whether or not the current scan is valid
Group (int attrIndexNum)
Constructor
~Group ()
Destructor
int AttrIndex ()
Returns the index of the critical attribute of the contained records
XxxBool IsEmpty ()
Returns XXX_TRUE if this group has no records in it
void AddRecord (XxxRecord *Rec)
Adds a record to this group
void FlushAllRecords (XxxBool DestroyRecs)
Removes all records from this group
void InitScan ()
Initializes a scan over the group
XxxBool ScanIsValid ()
Returns XXX_TRUE if the current scan is valid
XxxRecord* GetNext ()
Gets the next record from the scan
void CloseScan ()
Closes the current scan
class SMJoinInfo
Contains the relevant information to store in the operator handle between calls to GetNextRecord
XxxBool Valid
Is the scan valid?
int LeftRelIndex
The indices of the left and right relations in the RelationArray
Group LeftGroup
The left, right, and output group structures
SMJoinInfo (int RightRelIndex, int LeftRelIndex, int RightAttrIndex, int LeftAttrIndex)
Constructor

Protected Methods

virtual XxxErrCode createJoinInfo (XxxDerivedRelation::CursorInfo* Handle, SMJoinInfo *&JoinInfo)
Creates the join info object for the SM run
virtual XxxErrCode getNextItem (XxxRelation* *RelationArray, XxxDerivedRelation::CursorInfo* Handle, int Index, XxxBool& Valid)
Gets the next record from the relation in the RelationArray indexed by the parameter
virtual XxxBool isEqual (XxxRecord *LeftRec, int LeftAttrIndex, XxxRecordSchema *LeftSchema, XxxRecord *RightRec, int RightAttrIndex, XxxRecordSchema *RightSchema)
Compares a left and right record and returns XXX_TRUE if they are equal with respect to their critical attributes
virtual XxxBool isLessThan (XxxRecord *LeftRec, int LeftAttrIndex, XxxRecordSchema *LeftSchema, XxxRecord *RightRec, int RightAttrIndex, XxxRecordSchema *RightSchema)
Compares a left and right record and returns XXX_TRUE if the left is less than the right with respect to their critical attributes
virtual XxxErrCode joinGroups (XxxDerivedRelation::CursorInfo* Handle, XxxRelation* *RelationArray, const XxxRecordSchema* Schema, SMJoinInfo *JoinInfo)
Joins the left and right groups by a cross-product (assuming the groups ought to be joined) and populates the output group
virtual XxxErrCode parseJoinPlan (XxxDerivedRelation::CursorInfo* Handle, int &LeftAttrIndex, int &LeftRelIndex, int &RightAttrIndex, int &RightRelIndex)
Parses the join plan, finding the location of the left and right relations and finding the indices of the critical attributes in each's records

Inherited from RelSPJPlanOp:


Inherited from RelDerivedPlanOp:


Inherited from RelPlanOp:


Documentation

The Sort-merge Join plan operator. This operator assumes it has two input streams or records, both sorted by a single attribute. The join condition must be an equality of these two attributes, e.g., ... WHERE A.id = B.id
class Group
Encapsulates the concept of a record group; maintains a linked- list of records and information on which attribute the join is based upon

struct Member
The linked-list node structure

Member* members
The head of the linked list

Member* currentMember
The cursor in scans

int attrIndex
The attribute of the records in the equality join condition

XxxBool scanValid
Whether or not the current scan is valid

Group(int attrIndexNum)
Constructor

~Group()
Destructor

int AttrIndex()
Returns the index of the critical attribute of the contained records

XxxBool IsEmpty()
Returns XXX_TRUE if this group has no records in it

void AddRecord(XxxRecord *Rec)
Adds a record to this group

void FlushAllRecords(XxxBool DestroyRecs)
Removes all records from this group
Parameters:
DestroyRecs - If XXX_TRUE, the records within will be explicitly destroyed; otherwise, only the linked-list structure will be destroyed.

void InitScan()
Initializes a scan over the group

XxxBool ScanIsValid()
Returns XXX_TRUE if the current scan is valid

XxxRecord* GetNext()
Gets the next record from the scan. Returns NULL if the scan is now invalid.

void CloseScan()
Closes the current scan

class SMJoinInfo
Contains the relevant information to store in the operator handle between calls to GetNextRecord

XxxBool Valid
Is the scan valid?

int LeftRelIndex
The indices of the left and right relations in the RelationArray

Group LeftGroup
The left, right, and output group structures

SMJoinInfo(int RightRelIndex, int LeftRelIndex, int RightAttrIndex, int LeftAttrIndex)
Constructor

virtual XxxErrCode createJoinInfo(XxxDerivedRelation::CursorInfo* Handle, SMJoinInfo *&JoinInfo)
Creates the join info object for the SM run

virtual XxxErrCode getNextItem(XxxRelation* *RelationArray, XxxDerivedRelation::CursorInfo* Handle, int Index, XxxBool& Valid)
Gets the next record from the relation in the RelationArray indexed by the parameter. Returns Valid == XXX_TRUE if the next record was returned.

virtual XxxErrCode joinGroups(XxxDerivedRelation::CursorInfo* Handle, XxxRelation* *RelationArray, const XxxRecordSchema* Schema, SMJoinInfo *JoinInfo)
Joins the left and right groups by a cross-product (assuming the groups ought to be joined) and populates the output group. In the process, it empties the input groups.

virtual XxxErrCode parseJoinPlan(XxxDerivedRelation::CursorInfo* Handle, int &LeftAttrIndex, int &LeftRelIndex, int &RightAttrIndex, int &RightRelIndex)
Parses the join plan, finding the location of the left and right relations and finding the indices of the critical attributes in each's records

virtual XxxBool isEqual(XxxRecord *LeftRec, int LeftAttrIndex, XxxRecordSchema *LeftSchema, XxxRecord *RightRec, int RightAttrIndex, XxxRecordSchema *RightSchema)
Compares a left and right record and returns XXX_TRUE if they are equal with respect to their critical attributes

virtual XxxBool isLessThan(XxxRecord *LeftRec, int LeftAttrIndex, XxxRecordSchema *LeftSchema, XxxRecord *RightRec, int RightAttrIndex, XxxRecordSchema *RightSchema)
Compares a left and right record and returns XXX_TRUE if the left is less than the right with respect to their critical attributes

virtual const char* PrintString()
Returns a string representation of this plan operator

virtual XxxErrCode GetNextRecord(XxxSetCursor& SCsr, XxxRelation* *RelationArray, const XxxRecordSchema* Schema, XxxRecord*& ReturnRec)
Gets the next record from this plan operator

virtual XxxErrCode InitHandle(XxxDerivedRelation::CursorInfo* Handle, XxxRelation* *RelationArray)
Initializes this plan operator

virtual XxxErrCode CloseHandle(XxxDerivedRelation::CursorInfo* Handle, XxxRelation* *RelationArray)
Closes the scan this plan operator offers

RelSMPlanOp(int NumChildren, RelPlanOp* Children[], RelCatalogInfo* CatInfo, XxxValExprPlanList* ExprPlanList, XxxBooleanExpressionPlan** SelPredPlans, XxxBooleanExpressionPlan** JoinPredPlans, XxxBooleanExpressionPlan** ResidPredPlans, XxxBooleanExpressionPlan* InitPlan)
Constructor

virtual ~RelSMPlanOp()
Destructor


This class has no child classes.
Author:
Mark A. Paskin, paskin@cs.cornell.edu
Version:
8/12/97

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de