LhxHashNodeAccessor Class Reference

Class implementing the hash table used in Hybrid Hash Join. More...

#include <LhxHashTable.h>

Inheritance diagram for LhxHashNodeAccessor:

LhxHashBlockAccessor LhxHashDataAccessor LhxHashKeyAccessor List of all members.

Public Member Functions

 LhxHashNodeAccessor ()
 LhxHashNodeAccessor (uint nextNodeOffsetInit)
 Constructor for derived classes with fields before the next node pointer.
PBuffer getCurrent ()
 
Returns:
current node associated with this accessor

void setCurrent (PBuffer nodePtrInit)
 Set the current node pointer for this accessor.
void reset ()
 Reset the node pointer to NULL.
PBuffer getBuffer ()
 
Returns:
buffer to the payload in this node

PBuffer getNext ()
 
Returns:
the next node

PBuffer getNextLocation ()
 
Returns:
the location which stores the next node pointer

void setNext (PBuffer nextNode)
 Set the next node pointer for node associated with this accessor.
void setNext (PBuffer inputNode, PBuffer nextNode)
 Set the next node pointer for an input node.
uint getNextFieldSize ()
 
Returns:
number of bytes required to store the next node pointer

uint getBufferOffset ()
 
Returns:
offset to the .


Private Attributes

uint nextNodeOffset
uint nodeBufferOffset
PBuffer nodePtr

Detailed Description

Class implementing the hash table used in Hybrid Hash Join.

The hash table class also has the ability to aggregate in place.

Author:
Rushan Chen
Version:
Id
//open/dev/fennel/hashexe/LhxHashTable.h#4

Definition at line 55 of file LhxHashTable.h.


Constructor & Destructor Documentation

LhxHashNodeAccessor::LhxHashNodeAccessor (  )  [inline]

Definition at line 1039 of file LhxHashTable.h.

References getNextFieldSize(), nextNodeOffset, and nodeBufferOffset.

01040 {
01041     nextNodeOffset = 0;
01042     nodeBufferOffset = nextNodeOffset + getNextFieldSize();
01043 }

LhxHashNodeAccessor::LhxHashNodeAccessor ( uint  nextNodeOffsetInit  )  [inline]

Constructor for derived classes with fields before the next node pointer.

The idea is to store the variable length payload at the end.

Parameters:
[in] nextNodeOffsetInit offset to store the next node pointer.

Definition at line 1045 of file LhxHashTable.h.

References getNextFieldSize(), nextNodeOffset, and nodeBufferOffset.

01046 {
01047     nextNodeOffset = nextNodeOffsetInit;
01048     nodeBufferOffset = nextNodeOffset + getNextFieldSize();
01049 }


Member Function Documentation

PBuffer LhxHashNodeAccessor::getCurrent (  )  [inline]

Returns:
current node associated with this accessor

Definition at line 1051 of file LhxHashTable.h.

References nodePtr.

Referenced by LhxHashKeyAccessor::getFirstData(), LhxHashKeyAccessor::getNextSlot(), LhxHashBlockAccessor::getSlot(), LhxHashKeyAccessor::isMatched(), LhxHashKeyAccessor::setFirstData(), LhxHashKeyAccessor::setMatched(), and LhxHashKeyAccessor::setNextSlot().

01052 {
01053     return nodePtr;
01054 }

void LhxHashNodeAccessor::setCurrent ( PBuffer  nodePtrInit  )  [inline]

Set the current node pointer for this accessor.

Parameters:
[in] nodePtrInit pointer to node that will be associated with this accessor

Definition at line 1061 of file LhxHashTable.h.

References nodePtr.

Referenced by reset(), LhxHashKeyAccessor::setCurrent(), LhxHashDataAccessor::setCurrent(), and LhxHashBlockAccessor::setCurrent().

01062 {
01063     nodePtr = nodePtrInit;
01064 }

void LhxHashNodeAccessor::reset (  )  [inline]

Reset the node pointer to NULL.

Reimplemented in LhxHashBlockAccessor.

Definition at line 1066 of file LhxHashTable.h.

References setCurrent().

Referenced by LhxHashTable::releaseResources(), and LhxHashBlockAccessor::reset().

01067 {
01068     setCurrent(NULL);
01069 }

PBuffer LhxHashNodeAccessor::getBuffer (  )  [inline]

Returns:
buffer to the payload in this node

Definition at line 1056 of file LhxHashTable.h.

References nodeBufferOffset, and nodePtr.

Referenced by LhxHashBlockAccessor::getSlot(), LhxHashDataAccessor::pack(), LhxHashKeyAccessor::pack(), LhxHashKeyAccessor::setCurrent(), LhxHashDataAccessor::setCurrent(), LhxHashBlockAccessor::setCurrent(), LhxHashKeyAccessor::unpack(), and LhxHashDataAccessor::unpack().

01057 {
01058     return (nodePtr + nodeBufferOffset);
01059 }

PBuffer LhxHashNodeAccessor::getNext (  )  [inline]

Returns:
the next node

Definition at line 1071 of file LhxHashTable.h.

References nextNodeOffset, and nodePtr.

Referenced by LhxHashTableReader::advanceData(), LhxHashTableReader::advanceKey(), LhxHashTableReader::advanceSlot(), LhxHashTable::aggData(), LhxHashTable::allocateResources(), LhxHashTable::allocBuffer(), LhxHashTable::findKeyLocation(), and LhxHashTable::printSlot().

01072 {
01073     // REVIEW jvs 25-Aug-2006:  Under what circumstances would
01074     // alignment be off?  Tuple sizes are always aligned.  Is it
01075     // because of the match indicator?  If so, it might make sense to
01076     // fold that into the tuple.
01077     /*
01078      * nodePtr+nextNodeOffset might not be aligned so copy the pointer
01079      * value out.
01080      */
01081     PBuffer returnPtr;
01082     memcpy((PBuffer)&returnPtr, nodePtr+nextNodeOffset, sizeof(PBuffer));
01083     return returnPtr;
01084 }

PBuffer LhxHashNodeAccessor::getNextLocation (  )  [inline]

Returns:
the location which stores the next node pointer

Definition at line 1086 of file LhxHashTable.h.

References nextNodeOffset, and nodePtr.

Referenced by LhxHashTable::findKeyLocation().

01087 {
01088     return nodePtr + nextNodeOffset;
01089 }

void LhxHashNodeAccessor::setNext ( PBuffer  nextNode  )  [inline]

Set the next node pointer for node associated with this accessor.

Parameters:
[in] nextNode pointer to the next node

Definition at line 1091 of file LhxHashTable.h.

References getNextFieldSize(), nextNodeOffset, and nodePtr.

Referenced by LhxHashKeyAccessor::addData(), LhxHashTable::addKeyData(), LhxHashTable::aggData(), LhxHashTable::allocateResources(), LhxHashTable::allocBlock(), and LhxHashTable::allocBuffer().

01092 {
01093     memcpy(nodePtr+nextNodeOffset, (PBuffer)&nextNode, getNextFieldSize());
01094 }

void LhxHashNodeAccessor::setNext ( PBuffer  inputNode,
PBuffer  nextNode 
) [inline]

Set the next node pointer for an input node.

Parameters:
[in] inputNode input node to set the next node pointer
[in] nextNode pointer to the next node

Definition at line 1096 of file LhxHashTable.h.

References getNextFieldSize(), and nextNodeOffset.

01097 {
01098     memcpy(inputNode+nextNodeOffset, (PBuffer)&nextNode, getNextFieldSize());
01099 }

uint LhxHashNodeAccessor::getNextFieldSize (  )  [inline]

Returns:
number of bytes required to store the next node pointer

Definition at line 1101 of file LhxHashTable.h.

Referenced by LhxHashNodeAccessor(), and setNext().

01102 {
01103     return sizeof(PBuffer);
01104 }

uint LhxHashNodeAccessor::getBufferOffset (  )  [inline]

Returns:
offset to the .

This is equivalent to the total space used for the variable length payload.

Definition at line 1106 of file LhxHashTable.h.

References nodeBufferOffset.

Referenced by LhxHashKeyAccessor::getAvgStorageSize(), LhxHashDataAccessor::getAvgStorageSize(), LhxHashKeyAccessor::getStorageSize(), LhxHashDataAccessor::getStorageSize(), and LhxHashBlockAccessor::init().

01107 {
01108     return nodeBufferOffset;
01109 }


Member Data Documentation

uint LhxHashNodeAccessor::nextNodeOffset [private]

Definition at line 62 of file LhxHashTable.h.

Referenced by getNext(), getNextLocation(), LhxHashNodeAccessor(), and setNext().

uint LhxHashNodeAccessor::nodeBufferOffset [private]

Definition at line 67 of file LhxHashTable.h.

Referenced by getBuffer(), getBufferOffset(), and LhxHashNodeAccessor().

PBuffer LhxHashNodeAccessor::nodePtr [private]

Definition at line 72 of file LhxHashTable.h.

Referenced by getBuffer(), getCurrent(), getNext(), getNextLocation(), setCurrent(), and setNext().


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:38 2009 for Fennel by  doxygen 1.5.1