Fennel: LhxHashTableReader Class Reference (original) (raw)

#include <[LhxHashTable.h](LhxHashTable%5F8h-source.html)>

List of all members.

Public Member Functions
void init (LhxHashTable *hashTableInit, LhxHashInfo const &hashInfo, uint buildInputIndex)
Initialize the hash table reader.
void bindKey (PBuffer key)
Bind this reader to a certain key.
void bindUnMatched ()
Bind this reader to unmatched keys.
bool getNext (TupleData &outputTuple)
Get the next outputTuple.
LhxHashTable * getHashTable ()
Private Member Functions
bool advanceSlot ()
Locate the next slot to produce tuples from.
bool advanceKey ()
Locate the next key to produce tuples from.
bool advanceData ()
Locate the next data to produce tuples from.
void produceTuple (TupleData &outputTuple)
Produce the curKey + curData into outputTuple.
void bind (PBuffer key)
Helper function for bindKey() and bindUnMatched().
Private Attributes
LhxHashTable * hashTable
Underlying hash table to read from.
bool isGroupBy
Marks if this hash table is built for aggregation.
PBuffer * curSlot
Current read location.
PBuffer curKey
PBuffer curData
PBuffer boundKey
If not NULL, only read tuple with matching keys.
bool returnUnMatched
If true, only return tuples with unmatched keys.
bool isPositioned
Whether reader is positioned.
LhxHashKeyAccessor hashKeyAccessor
Accessors for the content of this hash table.
LhxHashDataAccessor hashDataAccessor
TupleProjection keyColsAndAggsProj
Fields in the outputTuple that will hold keyCols and Aggs, and data columns.
TupleProjection dataProj

Detailed Description

Definition at line 908 of file LhxHashTable.h.


Member Function Documentation

| bool LhxHashTableReader::advanceSlot | ( | | ) | [private] | | ------------------------------------ | - | | - | ----------- |

Locate the next slot to produce tuples from.

Set up the curKey and curData pointers.

Returns:

false if there is no more slots with keys.

Definition at line 1019 of file LhxHashTable.cpp.

References boundKey, curData, curKey, curSlot, LhxHashKeyAccessor::getFirstData(), LhxHashTable::getFirstSlot(), LhxHashNodeAccessor::getNext(), LhxHashTable::getNextSlot(), hashDataAccessor, hashKeyAccessor, hashTable, isGroupBy, LhxHashKeyAccessor::isMatched(), isPositioned, returnUnMatched, LhxHashDataAccessor::setCurrent(), and LhxHashKeyAccessor::setCurrent().

Referenced by getNext().

| bool LhxHashTableReader::advanceKey | ( | | ) | [private] | | ----------------------------------- | - | | - | ----------- |

Locate the next key to produce tuples from.

Set up the curKey and curData pointers.

Returns:

false if there is no more keys in the same slot.

Definition at line 1083 of file LhxHashTable.cpp.

References curData, curKey, LhxHashKeyAccessor::getFirstData(), LhxHashNodeAccessor::getNext(), hashDataAccessor, hashKeyAccessor, isGroupBy, LhxHashKeyAccessor::isMatched(), returnUnMatched, LhxHashDataAccessor::setCurrent(), and LhxHashKeyAccessor::setCurrent().

Referenced by getNext().

| bool LhxHashTableReader::advanceData | ( | | ) | [private] | | ------------------------------------ | - | | - | ----------- |

void LhxHashTableReader::produceTuple ( TupleData & outputTuple ) [private]
void LhxHashTableReader::bind ( PBuffer key ) [inline, private]

Initialize the hash table reader.

Parameters:

[in] hashTableInit the underlying hash table to read from
[in] hashInfo
[in] buildInputIndex which input is the build side.

Definition at line 1132 of file LhxHashTable.cpp.

References LhxHashInfo::aggsProj, bindKey(), LhxHashInfo::dataProj, dataProj, hashDataAccessor, hashKeyAccessor, hashTable, LhxHashDataAccessor::init(), LhxHashKeyAccessor::init(), LhxHashInfo::inputDesc, isGroupBy, LhxHashTable::isHashGroupBy(), keyColsAndAggsProj, and LhxHashInfo::keyProj.

Referenced by LhxJoinExecStream::execute(), LhxAggExecStream::execute(), LhxPartitionWriter::open(), LhxJoinExecStream::open(), LhxAggExecStream::open(), LhxHashTableTest::testInsert(), and LhxHashTableTest::writeHashTable().

void LhxHashTableReader::bindKey ( PBuffer key ) [inline]

| void LhxHashTableReader::bindUnMatched | ( | | ) | [inline] | | -------------------------------------- | - | | - | ---------- |

bool LhxHashTableReader::getNext ( TupleData & outputTuple )

Get the next outputTuple.

Parameters:

Returns:

false if no more tuples to output.

Definition at line 1190 of file LhxHashTable.cpp.

References advanceData(), advanceKey(), advanceSlot(), boundKey, isPositioned, produceTuple(), and returnUnMatched.

Referenced by LhxPartitionWriter::aggAndMarshalTuple(), LhxPartitionWriter::close(), LhxJoinExecStream::execute(), LhxAggExecStream::execute(), LhxHashTableTest::testInsert(), and LhxHashTableTest::writeHashTable().

01191 { 01192 if (isPositioned) { 01193 assert (!(boundKey && returnUnMatched)); 01194 01195
01196 01197 01198 if (advanceSlot()) { 01199
01200 01201 01202 return false; 01203 } 01204 produceTuple(outputTuple); 01205 isPositioned = true; 01206 return true; 01207 } 01208 01209 if (advanceData()) { 01210 produceTuple(outputTuple); 01211 return true; 01212 } else { 01213 if (boundKey) { 01214
01215 01216 01217 return false; 01218 } else { 01219
01220 01221 01222 if (advanceKey()) { 01223 produceTuple(outputTuple); 01224 return true; 01225 } else { 01226
01227 01228 01229 01230 if (advanceSlot()) { 01231 produceTuple(outputTuple); 01232 return true; 01233 } else { 01234 return false; 01235 } 01236 } 01237 } 01238 } 01239 }

| LhxHashTable * LhxHashTableReader::getHashTable | ( | | ) | [inline] | | -------------------------------------------------------------------------- | - | | - | ---------- |


Member Data Documentation

Marks if this hash table is built for aggregation.

Aggregating hash table only contains keys (group by keys plus aggregates) and does not contain data portion. The reader behavior will thus be different from reading a hash table built for joins.

Definition at line 922 of file LhxHashTable.h.

Referenced by advanceData(), advanceKey(), advanceSlot(), init(), and produceTuple().

Fields in the outputTuple that will hold keyCols and Aggs, and data columns.

output tuple should have the same shape as outputTupleDesc used in the init() method.

Definition at line 963 of file LhxHashTable.h.

Referenced by init(), and produceTuple().


The documentation for this class was generated from the following files:


Generated on Mon Jun 22 04:00:38 2009 for Fennel by doxygen 1.5.1