Fennel: LbmIterableRidReader Class Reference (original) (raw)

LbmIterableRidReader provides an iterator interface to a rid reader. More...

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

Inheritance diagram for LbmIterableRidReader:

List of all members.

Public Member Functions
bool hasNext ()
Determines whether there are more rids to be read.
LcsRid peek ()
Peeks at the current rid value without consuming it.
void advance ()
Advances past the current rid value.
LcsRid getNext ()
Gets the current rid value and advances to the next one.
Protected Member Functions
void initCommon ()
Common initialization method, called by all other init methods.
bool searchForNextRid ()
Searches for the next rid and buffers it.
void resetState ()
Resets state variables so next call to rid reader will read a new tuple from the input stream.
ExecStreamResult advanceToRid (LcsRid rid)
Advances input to the next rowid >= rid where rowid corresponds to a set bit in a bitmap segment.
ExecStreamResult readRidAndAdvance (LcsRid &rid)
Retrieves rid and sets up caller to advance forward to the next set bit in the input for the next call.
uint computeSpaceForZeroBytes (uint nZeroBytes)
Computes the number of bytes required to store a specified number of zero bytes.
uint computeSegLength (PBuffer segDesc)
Computes the length of the remaining segments in the current bitmap segment, starting at the one specified by the input segment descriptor.
uint computeSegDescLength (PBuffer segDesc)
Computes the length of the remaining segment descriptors in the current bitmap segment, starting at the one specified by the input segment descriptor.
uint countSegments ()
Returns the number of segments in an entry.
uint getZeroLengthByteCount (uint8_t segDescByte)
Get the number of bytes to store the length of zero bytes.
LcsRid getStartRID ()
**Returns:**startRID of this bitmap segment
Static Protected Member Functions
static uint byteArray2Value (PBuffer array, uint arraySize)
Get value stored in a byte array.
static uint value2ByteArray (uint value, PBuffer array, uint arraySize)
Store value in a byte array.
static void readSegDescAndAdvance (PBuffer &pSegDesc, uint &bmSegLen, uint &zeroBytes)
Decodes the lengths stored in the descriptor for a segment, based on where the segment descriptor is currently pointing, and advances the segment descriptor to the next descriptor.
static LcsRid roundToByteBoundary (LcsRid rid)
Rounds a rid value down to the nearest byte boundary.
static bool setSegLength (uint8_t &segDescByte, uint segLen)
Sets the length descriptor for a new segment with zero trailing zeros.
static bool adjustSegLength (uint8_t &segDescByte, uint segLen)
Set segment length in an existing descriptor with the new segment length.
static uint getSegLength (uint8_t segDescByte)
Get the segment length encoded in SegmentDescriptor.
Protected Attributes
bool buffered
True if a rid has been read, but not consumed.
LcsRid bufferedRid
If a rid has been buffered, this field contains its value.
LbmSegmentReader segmentReader
Segment reader.
bool firstReadDone
True if initial read has been completed.
uint curByte
Unread bits from current byte.
LcsRid curRid
Position in current bit segment.
bool moveNext
True if need to move to the next bit.
LcsRid nextRid
Next rid value that should be read.
LcsRid startRID
Starting rid in the bitmap segment (if singleton, startRID == RID column in entryTuple).
PBuffer pSegDescStart
Increment forward from pSegDescStart.
PBuffer pSegDescEnd
PBuffer pSegStart
Decrement backward from pSegStart.
PBuffer pSegEnd
Static Protected Attributes
static const uint LbmHalfByteSize = 4
Use half of a byte to encode the segment length, or the zero bytes length.
static const uint8_t LbmSegLengthMask = 0xf0
The upper 4 bits of Segment Descriptor byte is used to store the length of the corresponding segment.
static const uint8_t LbmZeroLengthMask = 0x0f
The lower 4 bits of Segment Descriptor byte is used to store the length of the "gap" following the corresponding segment(till the next segment or the next LbmEntry).
static const uint LbmZeroLengthCompact = 12
If the length of zero bytes(a byte composed of 8 bits of 0s) is less than 12, the length can be stored within the segment descriptor.
static const uint LbmZeroLengthExtended
Additional bytes(maximumn is 3 bytes) in which the length is stored.
static const uint LbmMaxSegSize = 16
Maximum size(in bytes) for a bitmap segment.
static const uint LbmOneByteSize = 8
One byte in the bitmap encodes 8 RIDs.
static const uint LbmOneByteSizeBitShift = 3
static const LcsRidPrimitive LbmOneByteSizeBitMask

Detailed Description

LbmIterableRidReader provides an iterator interface to a rid reader.

Note that this class does not support the buffer underflow state, EXECRC_BUF_UNDERFLOW. An assertion error will be thrown if the segment reader is initialized with a tuple reader that returns this state.

Definition at line 143 of file LbmRidReader.h.


Member Function Documentation

| void LbmIterableRidReader::initCommon | ( | | ) | [protected] | | ------------------------------------- | - | | - | ------------- |

| bool LbmIterableRidReader::searchForNextRid | ( | | ) | [inline, protected] | | ------------------------------------------- | - | | - | --------------------- |

| bool LbmIterableRidReader::hasNext | ( | | ) | [inline] | | ---------------------------------- | - | | - | ---------- |

| LcsRid LbmIterableRidReader::peek | ( | | ) | [inline] | | --------------------------------- | - | | - | ---------- |

| void LbmIterableRidReader::advance | ( | | ) | [inline] | | ---------------------------------- | - | | - | ---------- |

| LcsRid LbmIterableRidReader::getNext | ( | | ) | [inline] | | ------------------------------------ | - | | - | ---------- |

| void LbmRidReaderBase::resetState | ( | | ) | [protected, inherited] | | --------------------------------- | - | | - | ------------------------ |

ExecStreamResult LbmRidReaderBase::readRidAndAdvance ( LcsRid & rid ) [inherited]
uint LbmSegment::byteArray2Value ( PBuffer array,
uint arraySize
) [static, protected, inherited]
uint LbmSegment::value2ByteArray ( uint value,
PBuffer array,
uint arraySize
) [static, protected, inherited]

Store value in a byte array.

The least significant bytes in the value is stored at the first location in the array.

Parameters:

value
array a byte array
arraySize size of the array(number of bytes)

Returns:

number of bytes used to store the value; 0 if the value requires more than arraySize bytes to store.

Definition at line 38 of file LbmSegment.cpp.

References LbmSegment::LbmOneByteSize.

Referenced by LbmEntry::setZeroLength().

00039 { 00040 assert(value != 0); 00041 00042 uint size = 0; 00043 00044 while (value > 0 && size < arraySize) { 00045 array[size] = (uint8_t)(value & 0xff); 00046 value = value >> LbmOneByteSize; 00047 size ++; 00048 } 00049
00050 00051 00052 00053 if (value > 0) { 00054 size = 0; 00055 } 00056 00057 return size; 00058 }

uint LbmSegment::computeSpaceForZeroBytes ( uint nZeroBytes ) [protected, inherited]
void LbmSegment::readSegDescAndAdvance ( PBuffer & pSegDesc,
uint & bmSegLen,
uint & zeroBytes
) [static, protected, inherited]

Decodes the lengths stored in the descriptor for a segment, based on where the segment descriptor is currently pointing, and advances the segment descriptor to the next descriptor.

Parameters:

pSegDesc pointer to segment descriptor
bmSegLen returns length of bitmap segment
zeroBytes returns number of trailing zeros in this segment

segment

Definition at line 75 of file LbmSegment.cpp.

References LbmSegment::byteArray2Value(), LbmSegment::LbmHalfByteSize, LbmSegment::LbmZeroLengthCompact, and LbmSegment::LbmZeroLengthMask.

Referenced by LbmSegmentReaderBase::advanceSegment(), LbmSegment::computeSegDescLength(), LbmSegment::computeSegLength(), LbmEntry::containsRid(), LbmSegment::countSegments(), LbmEntry::dumpSeg(), LbmEntry::dumpSegRID(), LbmEntry::generateSegRIDs(), LbmEntry::spliceSingleton(), and LbmEntry::splitEntry().

uint LbmSegment::computeSegLength ( PBuffer segDesc ) [protected, inherited]
uint LbmSegment::computeSegDescLength ( PBuffer segDesc ) [protected, inherited]

| uint LbmSegment::countSegments | ( | | ) | [protected, inherited] | | ------------------------------------------------------------------------------------------- | - | | - | ------------------------ |

LcsRid LbmSegment::roundToByteBoundary ( LcsRid rid ) [inline, static, inherited]

Rounds a rid value down to the nearest byte boundary.

Parameters:

Returns:

rounded rid value

Definition at line 241 of file LbmSegment.h.

References LbmSegment::LbmOneByteSizeBitMask, and opaqueToInt().

Referenced by LbmRidReaderBase::advanceToRid(), LbmEntry::closeCurrentSegment(), LbmEntryTest::compareExpected(), LbmSplicerExecStream::findBetterEntry(), LbmSplicerExecStream::findBTreeEntry(), LbmEntry::mergeEntry(), LbmEntry::openNewSegment(), LbmSplicerExecStream::ridOverlaps(), LbmRidReaderBase::searchForNextRid(), LbmEntry::setRIDAdjacentSegByte(), LbmEntry::singleton2Bitmap(), LbmEntryTest::testldb35(), and LbmEntryTest::testZeroBytes().

bool LbmSegment::setSegLength ( uint8_t & segDescByte,
uint segLen
) [inline, static, inherited]
bool LbmSegment::adjustSegLength ( uint8_t & segDescByte,
uint segLen
) [inline, static, inherited]
uint LbmSegment::getSegLength ( uint8_t segDescByte ) [inline, static, inherited]
uint LbmSegment::getZeroLengthByteCount ( uint8_t segDescByte ) [inline, inherited]

| LcsRid LbmSegment::getStartRID | ( | | ) | [inline, inherited] | | ------------------------------ | - | | - | --------------------- |


Member Data Documentation

Starting rid in the bitmap segment (if singleton, startRID == RID column in entryTuple).

Definition at line 42 of file LbmSegment.h.

Referenced by LbmEntry::adjustEntry(), LbmEntry::containsRid(), LbmSeqSegmentReader::getSrid(), LbmSegment::getStartRID(), LbmEntry::growEntry(), LbmEntry::inRange(), LbmEntry::mergeEntry(), LbmEntry::mergeIntoSplitEntry(), LbmEntry::openLastSegment(), LbmEntry::produceEntryTuple(), LbmSegmentReaderBase::readBitmapSegTuple(), LbmEntry::setEntryTuple(), LbmEntry::singleton2Bitmap(), LbmEntry::spliceSingleton(), and LbmEntry::splitEntry().

Increment forward from pSegDescStart.

Definition at line 47 of file LbmSegment.h.

Referenced by LbmSegmentReaderBase::advanceSegment(), LbmSegmentReader::advanceToByte(), LbmEntry::containsRid(), LbmSegment::countSegments(), LbmEntry::getRowCount(), LbmSegmentReaderBase::init(), LbmEntry::isSingleBitmap(), LbmEntry::LbmEntry(), LbmEntry::mergeIntoSplitEntry(), LbmEntry::produceEntryTuple(), LbmSegmentReaderBase::readBitmapSegTuple(), LbmSegmentReader::readSegment(), LbmSeqSegmentReader::readSegmentAndAdvance(), LbmEntry::setEntryTuple(), LbmEntry::singleton2Bitmap(), LbmEntry::spliceSingleton(), LbmEntry::splitEntry(), and LbmEntry::toString().

Definition at line 48 of file LbmSegment.h.

Referenced by LbmEntry::addNewAdjacentSegment(), LbmEntry::addNewMiddleSegment(), LbmEntry::addSegDesc(), LbmSegmentReader::advanceToByte(), LbmEntry::closeCurrentSegment(), LbmSegment::computeSegDescLength(), LbmSegment::computeSegLength(), LbmEntry::containsRid(), LbmEntry::copyToMergeBuffer(), LbmSegment::countSegments(), LbmEntry::getRowCount(), LbmSegmentReaderBase::init(), LbmEntry::mergeEntry(), LbmEntry::mergeIntoSplitEntry(), LbmEntry::openLastSegment(), LbmEntry::openNewSegment(), LbmEntry::produceEntryTuple(), LbmSegmentReaderBase::readBitmapSegTuple(), LbmSeqSegmentReader::readSegmentAndAdvance(), LbmEntry::setEntryTuple(), LbmEntry::spliceSingleton(), LbmEntry::splitEntry(), and LbmEntry::toString().

Decrement backward from pSegStart.

Definition at line 53 of file LbmSegment.h.

Referenced by LbmEntry::adjustEntry(), LbmSegmentReaderBase::advanceSegment(), LbmSegmentReader::advanceToByte(), LbmEntry::containsRid(), LbmSegmentReaderBase::init(), LbmEntry::isSingleton(), LbmEntry::LbmEntry(), LbmEntry::mergeEntry(), LbmEntry::mergeIntoSplitEntry(), LbmEntry::openNewSegment(), LbmEntry::produceEntryTuple(), LbmSegmentReaderBase::readBitmapSegTuple(), LbmSegmentReader::readCurrentByteSegment(), LbmSeqSegmentReader::readSegmentAndAdvance(), LbmEntry::setEntryTuple(), LbmEntry::setRIDAdjacentSegByte(), LbmEntry::spliceSingleton(), LbmEntry::splitEntry(), and LbmEntry::toString().

Definition at line 54 of file LbmSegment.h.

Referenced by LbmEntry::addNewRid(), LbmEntry::adjustEntry(), LbmEntry::containsRid(), LbmEntry::copyToMergeBuffer(), LbmEntry::isSingleton(), LbmEntry::mergeEntry(), LbmEntry::mergeIntoSplitEntry(), LbmEntry::openLastSegment(), LbmEntry::openNewSegment(), LbmEntry::produceEntryTuple(), LbmEntry::setEntryTuple(), LbmEntry::setRIDAdjacentSegByte(), LbmEntry::splitEntry(), and LbmEntry::toString().

One byte in the bitmap encodes 8 RIDs.

Definition at line 235 of file LbmSegment.h.

Referenced by LbmEntry::addNewAdjacentSegment(), LbmEntry::addNewMiddleSegment(), LbmEntry::addNewRid(), LbmEntry::addNewSegment(), LbmSegmentWriter::addSegment(), LbmEntry::adjustEntry(), LbmRidReaderBase::advanceToRid(), LbmSegment::byteArray2Value(), LbmMinusExecStream::canSkipMinus(), LbmEntry::closeCurrentSegment(), LbmUnionExecStream::computeRidLimit(), LbmSegment::computeSpaceForZeroBytes(), LbmEntry::containsRid(), LbmEntry::dumpSegRID(), LbmMinusExecStream::execute(), LbmSplicerExecStream::findBetterEntry(), LbmEntryTest::generateBitmaps(), LbmEntryTest::generateCompressedBitmaps(), LbmEntry::generateSegRIDs(), LbmEntryTest::generateSingleBitmaps(), LbmEntry::getCompressedRowCount(), LbmEntry::getRowCount(), LbmIntersectExecStream::intersectSegments(), LbmMinusExecStream::minusSegments(), LbmEntry::openLastSegment(), LbmSegmentReaderBase::readBitmapSegTuple(), LbmSplicerExecStream::ridOverlaps(), LbmRidReaderBase::searchForNextRid(), LbmEntry::segmentContainsRid(), LbmSegmentReaderBase::setBitsRead(), LbmEntry::setEntryTuple(), LbmEntry::setRID(), LbmEntry::setRIDAdjacentSegByte(), LbmEntry::setRIDSegByte(), LbmEntry::spliceSingleton(), LbmEntry::splitEntry(), LbmEntryTest::testldb35(), LbmEntryTest::testler5920(), LbmEntryTest::testZeroBytes(), and LbmSegment::value2ByteArray().


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


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