Fennel: TupleAccessor Class Reference (original) (raw)

TupleAccessor defines how to efficiently marshal and unmarshal values in a stored tuple. More...

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

List of all members.

Public Types
typedef uint16_t StoredValueOffset
Public Member Functions
TupleAccessor ()
virtual ~TupleAccessor ()
void compute (TupleDescriptor const &tuple, TupleFormat format=TUPLE_FORMAT_STANDARD)
Precomputes access for a particular tuple format.
uint getMaxByteCount () const
**Returns:**the maximum possible tuple storage size in bytes
uint getMinByteCount () const
**Returns:**the minimum possible tuple storage size in bytes
bool isFixedWidth () const
**Returns:**whether all tuples have the same fixed size
uint getBitFieldOffset () const
**Returns:**the offset of the first byte of bit fields, or MAXU if no bit fields
PConstBuffer getCurrentTupleBuf () const
Accesses the buffer storing the current tuple image.
void setCurrentTupleBuf (PConstBuffer pTupleBuf, bool valid=true)
Sets the buffer storing the current tuple image.
void resetCurrentTupleBuf ()
Forgets the current tuple buffer.
uint getCurrentByteCount () const
Determines the number of bytes stored in the current tuple buffer.
uint getBufferByteCount (PConstBuffer pBuf) const
Determines the number of bytes stored in a tuple buffer without actually preparing to unmarshal it.
uint getByteCount (TupleData const &tuple) const
Determines the number of bytes required to store a tuple without actually marshalling it.
bool isBufferSufficient (TupleData const &tuple, uint cbBuffer) const
Determines whether a buffer is big enough to fit marshalled tuple data.
void unmarshal (TupleData &tuple, uint iFirstDatum=0) const
Unmarshals the current tuple buffer, setting a tuple's values to reference the contents.
AttributeAccessor const & getAttributeAccessor (uint iAttribute) const
Gets an accessor for an individual attribute.
void marshal (TupleData const &tuple, PBuffer pTupleBuf)
Marshals a tuple's values into a buffer.
uint size () const
**Returns:**number of attributes accessed
boost::dynamic_bitset< FixedBuffer > const & getBitFields () const
**Returns:**the array of bit fields for the current tuple image
StoredValueOffset const * referenceIndirectOffset (uint iIndirectOffset) const
Resolves an indirect offset into a pointer to the data offset.
Static Public Member Functions
static StoredValueOffset * referenceIndirectOffset (PBuffer pTupleBuf, uint iIndirectOffset)
Resolves an indirect offset into a pointer to the data offset.
Static Public Attributes
static const bool BOOL_TRUE
Constant value for true.
static const bool BOOL_FALSE
Constant value for false.
Private Member Functions
void initFixedAccessors (TupleDescriptor const &, VectorOfUint &)
void clear ()
Private Attributes
std::vector< AttributeAccessor * > ppAttributeAccessors
Precomputed accessors for attributes, in logical tuple order.
VectorOfUint pVarWidthAttrIndices
Array of 0-based indices of variable-width attributes.
VectorOfUint marshalOrder
Permutation in which attributes should be marshalled; empty when !bAlignedVar, in which case attributes should be marshalled in logical order.
uint cbMaxStorage
See also:getMaxByteCount()
uint cbMinStorage
See also:getMinByteCount()
uint nBitFields
Precomputed size of bit field array (in bits).
uint iBitFieldOffset
Precomputed byte offset for bit array.
uint iFirstVarEndIndirectOffset
Precomputed offset for indirect offset of end of first variable-width attribute, or MAXU if there are no variable-width attributes.
uint iLastVarEndIndirectOffset
Precomputed offset for indirect offset of end of last variable-width attribute, or MAXU if there are no variable-length attributes.
uint iFirstVarOffset
Precomputed offset for fixed start of first variable-width attribute, or MAXU if there are no variable-width attributes.
bool bAlignedVar
Whether any variable-width attributes with alignment requirements (currently restricted to 2-byte alignment for UNICODE strings) are present.
PConstBuffer pTupleBuf
See also:getCurrentTupleBuf()
boost::dynamic_bitset< FixedBuffer > bitFields
See also:getBitFields()
TupleFormat format

Detailed Description

TupleAccessor defines how to efficiently marshal and unmarshal values in a stored tuple.

The same logical tuple definition can have multiple storage formats. See the design docs for more details.

Definition at line 48 of file TupleAccessor.h.


Member Typedef Documentation


Constructor & Destructor Documentation

| TupleAccessor::TupleAccessor | ( | | ) | [explicit] | | ---------------------------- | - | | - | ------------ |

| TupleAccessor::~TupleAccessor | ( | | ) | [virtual] | | ------------------------------ | - | | - | ----------- |


Member Function Documentation

| void TupleAccessor::clear | ( | | ) | [private] | | ------------------------- | - | | - | ----------- |

Precomputes access for a particular tuple format.

Must be called before any other method.

Parameters:

tuple the tuple to be accessed
format how to store tuple

Definition at line 85 of file TupleAccessor.cpp.

References alignRoundUp(), bAlignedVar, bitFields, bytesForBits(), cbMaxStorage, cbMinStorage, AttributeAccessor::cbStorage, TupleAttributeDescriptor::cbStorage, clear(), format, StoredTypeDescriptor::getAlignmentByteCount(), getAttributeAccessor(), StoredTypeDescriptor::getBitCount(), StoredTypeDescriptor::getFixedByteCount(), StoredTypeDescriptor::getMinByteCount(), StoredTypeDescriptor::getOrdinal(), iBitFieldOffset, iFirstVarEndIndirectOffset, iFirstVarOffset, AttributeAccessor::iFixedOffset, iLastVarEndIndirectOffset, initFixedAccessors(), AttributeAccessor::iNullBit, StandardTypeDescriptor::isArray(), isMAXU(), TupleAttributeDescriptor::isNullable, marshalOrder, MAXU, nBitFields, ppAttributeAccessors, TupleAttributeDescriptor::pTypeDescriptor, pVarWidthAttrIndices, TUPLE_FORMAT_ALL_FIXED, and TUPLE_FORMAT_NETWORK.

Referenced by BTreeAccessBase::BTreeAccessBase(), BTreeReadersTest::BTreeReadersTest(), BTreeTest::BTreeTest(), TupleDataWithBuffer::computeAndAllocate(), ReshapeExecStream::copyCompareTuple(), FtrsTableWriter::createIndexWriter(), CalcAssembler::createTupleData(), ExternalSortMerger::ExternalSortMerger(), ExternalSortOutput::ExternalSortOutput(), ExternalSortRunAccessor::ExternalSortRunAccessor(), ExternalSortRunLoader::ExternalSortRunLoader(), FtrsTableWriter::FtrsTableWriter(), LcsRowScanExecStreamTest::generateBitmaps(), LbmSplicerExecStreamTest::generateRidInput(), LbmSplicerExecStreamTest::generateTupleInput(), LhxHashKeyAccessor::init(), LhxHashDataAccessor::init(), LbmSearchTest::initEqualSearch(), LbmExecStreamTestBase::initKeyBitmap(), ExternalSortRunAccessor::initRead(), Java_net_sf_farrago_fennel_FennelStorage_getAccessorXmiForTupleDescriptor(), BTreeNodeAccessor::onInit(), LhxPartitionReader::open(), LhxPartitionWriter::open(), ErrorSource::postError(), LbmSearchExecStream::prepare(), LbmNormalizerExecStream::prepare(), BTreePrefetchSearchExecStream::prepare(), ExecStreamBufAccessor::setTupleShape(), TestCalculator::setUp(), LbmExecStreamTestBase::testCaseSetUp(), CollectExecStreamTestSuite::testCollectInts(), LcsRowScanExecStreamTest::testFilterCols(), LbmSplicerExecStreamTest::testLER5968(), LbmSplicerExecStreamTest::testLER6473(), ExecStreamTestSuite::testMergeImplicitPullInputs(), BTreeTest::testMultiKeySearches(), LbmSearchTest::testMultipleRanges(), ExecStreamTestSuite::testReshapeExecStream(), TupleTest::testStandardTypes(), TupleTest::testZeroByteTuple(), tupleFiddle(), unitTestBool(), unitTestFloat(), unitTestLong(), unitTestNullableLocal(), unitTestPointer(), unitTestPointerCache(), unitTestStatusRegister(), unitTestWarnings(), and ExecStreamUnitTestBase::verifyBufferedOutput().

00087 { 00088 clear(); 00089 format = formatInit; 00090 00091
00092
00093 VectorOfUint aligned8; 00094 VectorOfUint aligned4; 00095 VectorOfUint aligned2; 00096 VectorOfUint unalignedFixed; 00097 VectorOfUint unalignedVar; 00098 VectorOfUint alignedVar2; 00099 00100
00101
00102 AttributeAccessor *pFirstVariableAccessor = NULL; 00103 00104
00105 nBitFields = 0; 00106 00107
00108 uint cbVarDataMax = 0; 00109 00110
00111
00112 cbMaxStorage = 0; 00113 00114 #if DEBUG_TUPLE_ACCESS 00115 cbMaxStorage += sizeof(MagicNumber); 00116 #endif 00117 00118
00119
00120 for (uint iAttr = 0; iAttr < tuple.size(); iAttr++) { 00121 AttributeAccessor *pNewAccessor; 00122 TupleAttributeDescriptor const &attr = tuple[iAttr]; 00123 uint cbFixed = attr.pTypeDescriptor->getFixedByteCount(); 00124 uint cbMin = attr.pTypeDescriptor->getMinByteCount(attr.cbStorage); 00125 if (cbFixed) { 00126 assert(cbFixed == attr.cbStorage); 00127 assert(cbFixed == cbMin); 00128 } 00129 bool bFixedWidth = (cbMin == attr.cbStorage); 00130 if (bFixedWidth && !attr.cbStorage) { 00131 if (!attr.pTypeDescriptor->getMinByteCount(1)) { 00132
00133
00134 bFixedWidth = false; 00135 } 00136 } 00137 bool bNullable = attr.isNullable; 00138 uint nBits = (attr.pTypeDescriptor->getBitCount()); 00139 assert(nBits <= 1); 00140 if (format == TUPLE_FORMAT_ALL_FIXED) { 00141 bFixedWidth = true; 00142 nBits = 0; 00143 } 00144 uint iAlign = attr.pTypeDescriptor->getAlignmentByteCount( 00145 attr.cbStorage); 00146 if (!bFixedWidth) { 00147 cbVarDataMax += attr.cbStorage; 00148 if (iAlign == 2) { 00149 alignedVar2.push_back(iAttr); 00150 bAlignedVar = true; 00151 } else { 00152 assert(iAlign == 1); 00153 unalignedVar.push_back(iAttr); 00154 } 00155
00156
00157
00158
00159 pNewAccessor = new VarOffsetAccessor(); 00160 } else if (nBits) { 00161 if (bNullable) { 00162 pNewAccessor = new NullableAccessor; 00163 } else { 00164 pNewAccessor = new BitAccessor; 00165 } 00166 pNewAccessor->iValueBit = nBitFields; 00167 nBitFields++; 00168 } else { 00169 assert((cbMin % iAlign) == 0); 00170 bool bArray = 00171 StandardTypeDescriptor::isArray( 00172 StandardTypeDescriptorOrdinal( 00173 attr.pTypeDescriptor->getOrdinal())); 00174 switch (iAlign) { 00175 case 2: 00176 if (bNullable) { 00177 if ((format == TUPLE_FORMAT_NETWORK) && !bArray) { 00178 pNewAccessor = 00179 new NullableAccessor; 00180 } else { 00181 pNewAccessor = 00182 new NullableAccessor; 00183 } 00184 } else { 00185 if ((format == TUPLE_FORMAT_NETWORK) && !bArray) { 00186 pNewAccessor = new FixedWidthNetworkAccessor16; 00187 } else { 00188 pNewAccessor = new FixedWidthAccessor; 00189 } 00190 } 00191 break; 00192 case 4: 00193 if (bNullable) { 00194 if (format == TUPLE_FORMAT_NETWORK) { 00195 pNewAccessor = 00196 new NullableAccessor; 00197 } else { 00198 pNewAccessor = 00199 new NullableAccessor; 00200 } 00201 } else { 00202 if (format == TUPLE_FORMAT_NETWORK) { 00203 pNewAccessor = new FixedWidthNetworkAccessor32; 00204 } else { 00205 pNewAccessor = new FixedWidthAccessor; 00206 } 00207 } 00208 break; 00209 case 8: 00210 if (bNullable) { 00211 if (format == TUPLE_FORMAT_NETWORK) { 00212 pNewAccessor = 00213 new NullableAccessor; 00214 } else { 00215 pNewAccessor = 00216 new NullableAccessor; 00217 } 00218 } else { 00219 if (format == TUPLE_FORMAT_NETWORK) { 00220 pNewAccessor = new FixedWidthNetworkAccessor64; 00221 } else { 00222 pNewAccessor = new FixedWidthAccessor; 00223 } 00224 } 00225 break; 00226 default: 00227 if (bNullable) { 00228 pNewAccessor = new NullableAccessor; 00229 } else { 00230 pNewAccessor = new FixedWidthAccessor; 00231 } 00232 break; 00233 } 00234 switch (iAlign) { 00235 case 1: 00236 unalignedFixed.push_back(iAttr); 00237 break; 00238 case 2: 00239 aligned2.push_back(iAttr); 00240 break; 00241 case 4: 00242 aligned4.push_back(iAttr); 00243 break; 00244 case 8: 00245 aligned8.push_back(iAttr); 00246 break; 00247 default: 00248 permAssert(false); 00249 } 00250 } 00251 if (bNullable) { 00252 pNewAccessor->iNullBit = nBitFields; 00253 nBitFields++; 00254 } 00255 pNewAccessor->cbStorage = attr.cbStorage; 00256 ppAttributeAccessors.push_back(pNewAccessor); 00257 } 00258 bitFields.resize(nBitFields); 00259 00260
00261
00262 pVarWidthAttrIndices.resize(alignedVar2.size() + unalignedVar.size()); 00263 std::copy( 00264 alignedVar2.begin(), alignedVar2.end(), 00265 pVarWidthAttrIndices.begin()); 00266 std::copy( 00267 unalignedVar.begin(), unalignedVar.end(), 00268 pVarWidthAttrIndices.begin() + alignedVar2.size()); 00269 for (uint i = 0; i < pVarWidthAttrIndices.size(); ++i) { 00270 uint iAttr = pVarWidthAttrIndices[i]; 00271 TupleAttributeDescriptor const &attr = tuple[iAttr]; 00272 bool bNullable = attr.isNullable; 00273 AttributeAccessor *pNewAccessor; 00274 if (pFirstVariableAccessor) { 00275 if (bNullable) { 00276 if (format == TUPLE_FORMAT_NETWORK) { 00277 pNewAccessor = 00278 new NullableAccessor< VarOffsetAccessor >; 00279 } else { 00280 pNewAccessor = 00281 new NullableAccessor< VarOffsetAccessor >; 00282 } 00283 } else { 00284 if (format == TUPLE_FORMAT_NETWORK) { 00285 pNewAccessor = new VarOffsetAccessor; 00286 } else { 00287 pNewAccessor = new VarOffsetAccessor; 00288 } 00289 } 00290 } else { 00291 if (bNullable) { 00292 if (format == TUPLE_FORMAT_NETWORK) { 00293 pFirstVariableAccessor = 00294 new NullableAccessor< 00295 FixedOffsetVarWidthAccessor >; 00296 } else { 00297 pFirstVariableAccessor = 00298 new NullableAccessor< 00299 FixedOffsetVarWidthAccessor >; 00300 } 00301 } else { 00302 if (format == TUPLE_FORMAT_NETWORK) { 00303 pFirstVariableAccessor = 00304 new FixedOffsetVarWidthAccessor; 00305 } else { 00306 pFirstVariableAccessor = 00307 new FixedOffsetVarWidthAccessor; 00308 } 00309 } 00310 pNewAccessor = pFirstVariableAccessor; 00311 } 00312 AttributeAccessor *pPlaceholder = ppAttributeAccessors[iAttr]; 00313 pNewAccessor->cbStorage = attr.cbStorage; 00314 pNewAccessor->iNullBit = pPlaceholder->iNullBit; 00315
00316 ppAttributeAccessors[iAttr] = pNewAccessor; 00317 delete pPlaceholder; 00318 } 00319 00320
00321
00322 initFixedAccessors(tuple,aligned8); 00323 initFixedAccessors(tuple,aligned4); 00324 initFixedAccessors(tuple,aligned2); 00325 00326 if (pFirstVariableAccessor) { 00327 iFirstVarEndIndirectOffset = cbMaxStorage; 00328 } else { 00329 iFirstVarEndIndirectOffset = MAXU; 00330 } 00331 00332 for (uint i = 0; i < pVarWidthAttrIndices.size(); i++) { 00333 ppAttributeAccessors[pVarWidthAttrIndices[i]]->iEndIndirectOffset = 00334 cbMaxStorage; 00335 cbMaxStorage += sizeof(StoredValueOffset); 00336 } 00337 00338 if (pFirstVariableAccessor) { 00339 iLastVarEndIndirectOffset = cbMaxStorage - sizeof(StoredValueOffset); 00340 } else { 00341 iLastVarEndIndirectOffset = MAXU; 00342 } 00343 00344 initFixedAccessors(tuple,unalignedFixed); 00345 00346 if (nBitFields) { 00347 iBitFieldOffset = cbMaxStorage; 00348 } else { 00349 iBitFieldOffset = MAXU; 00350 } 00351 cbMaxStorage += bytesForBits(nBitFields); 00352 if (pFirstVariableAccessor) { 00353 if (bAlignedVar) { 00354
00355
00356 if (cbMaxStorage & 1) { 00357 ++cbMaxStorage; 00358 } 00359 } 00360 pFirstVariableAccessor->iFixedOffset = cbMaxStorage; 00361 iFirstVarOffset = cbMaxStorage; 00362 } else { 00363 iFirstVarOffset = MAXU; 00364 } 00365 cbMinStorage = cbMaxStorage; 00366 cbMaxStorage += cbVarDataMax; 00367 00368
00369
00370
00371 if (cbMaxStorage) { 00372 cbMinStorage = 1; 00373 cbMaxStorage = 1; 00374 } 00375 00376
00377
00378
00379 cbMinStorage = alignRoundUp(cbMinStorage); 00380 cbMaxStorage = alignRoundUp(cbMaxStorage); 00381 00382
00383
00384 if (bAlignedVar) { 00385
00386 for (uint i = 0; i < tuple.size(); ++i) { 00387 AttributeAccessor const &accessor = getAttributeAccessor(i); 00388 if (isMAXU(accessor.iEndIndirectOffset)) { 00389 marshalOrder.push_back(i); 00390 } 00391 } 00392 uint nFixed = marshalOrder.size(); 00393 assert(nFixed + pVarWidthAttrIndices.size() == tuple.size()); 00394 marshalOrder.resize(tuple.size()); 00395
00396 std::copy( 00397 pVarWidthAttrIndices.begin(), 00398 pVarWidthAttrIndices.end(), 00399 marshalOrder.begin() + nFixed); 00400 } 00401 }

| uint TupleAccessor::getMaxByteCount | ( | | ) | const [inline] | | ------------------------------------------------------------------------------------------------ | - | | - | ---------------- |

Returns:

the maximum possible tuple storage size in bytes

Definition at line 165 of file TupleAccessor.h.

Referenced by BTreeReadersTest::BTreeReadersTest(), BTreeTest::BTreeTest(), TupleDataWithBuffer::computeAndAllocate(), CalcAssembler::createTupleData(), FtrsTableWriter::FtrsTableWriter(), LhxHashKeyAccessor::getAvgStorageSize(), LhxHashDataAccessor::getAvgStorageSize(), BTreePrefetchSearchExecStream::getResourceRequirements(), LbmSearchTest::initEqualSearch(), LbmExecStreamTestBase::initKeyBitmap(), isBufferSufficient(), ExternalSortRunLoader::loadRun(), BTreeCompactNodeAccessor::onInit(), LcsClusterAppendExecStream::open(), MockResourceExecStream::open(), ErrorSource::postError(), FtrsTableWriterExecStream::prepare(), MockProducerExecStream::prepare(), BarrierExecStream::prepare(), TestCalculator::setUp(), CollectExecStreamTestSuite::testCollectInts(), TupleTest::testDebugAccess(), LcsRowScanExecStreamTest::testFilterCols(), TupleTest::testMarshal(), ExecStreamTestSuite::testMergeImplicitPullInputs(), BTreeTest::testMultiKeySearches(), LbmSearchTest::testMultipleRanges(), ExecStreamTestSuite::testReshapeExecStream(), TupleTest::testStandardTypes(), TupleTest::testZeroByteTuple(), tupleFiddle(), unitTestBool(), unitTestFloat(), unitTestLong(), unitTestNullableLocal(), unitTestPointer(), unitTestPointerCache(), unitTestStatusRegister(), and unitTestWarnings().

| uint TupleAccessor::getMinByteCount | ( | | ) | const [inline] | | ------------------------------------------------------------------------------------------------ | - | | - | ---------------- |

| bool TupleAccessor::isFixedWidth | ( | | ) | const [inline] | | -------------------------------- | - | | - | ---------------- |

| uint TupleAccessor::getBitFieldOffset | ( | | ) | const [inline] | | -------------------------------------------------------------------------------------------------- | - | | - | ---------------- |

| PConstBuffer TupleAccessor::getCurrentTupleBuf | ( | | ) | const [inline] | | -------------------------------------------------------------------------------------------------- | - | | - | ---------------- |

Accesses the buffer storing the current tuple image.

Returns:

address of tuple image, or NULL if no current tuple

Definition at line 200 of file TupleAccessor.h.

Referenced by ExecStreamBufAccessor::accessConsumptionTuple(), BTreeNodeAccessor::compactNode(), ExecStreamBufAccessor::consumeTuple(), BTreeWriter::deleteCurrent(), FtrsTableWriter::execute(), BTreeSortExecStream::execute(), LcsRowScanExecStream::initializeFiltersIfNeeded(), LhxPartitionReader::isTupleConsumptionPending(), ExecStreamBufAccessor::isTupleConsumptionPending(), BTreeNodeAccessor::splitNode(), unmarshal(), VarOffsetAccessor< network >::unmarshalValue(), FixedOffsetVarWidthAccessor< network >::unmarshalValue(), and FixedWidthAccessor::unmarshalValue().

void TupleAccessor::setCurrentTupleBuf ( PConstBuffer pTupleBuf,
bool valid = true
)

Sets the buffer storing the current tuple image.

Must be called before getCurrentByteCount and unmarshal.

Parameters:

pTupleBuf address of tuple image
valid (default: true) the buffer contains a marshalled tuple. False means the buffer is free space; unmarshal binds a TupleData to the buffer. This is useful only for TUPLE_FORMAT_ALL_FIXED.

REVIEW: An alternative is to require the caller to zero out the buffer; but that seems riskier.

Definition at line 463 of file TupleAccessor.cpp.

References bitFields, iBitFieldOffset, isMAXU(), pTupleBuf, and TUPLE_MAGIC_NUMBER.

Referenced by ExecStreamBufAccessor::accessConsumptionTuple(), BTreeWriter::checkMonotonicity(), TupleDataWithBuffer::computeAndAllocate(), ReshapeExecStream::copyCompareTuple(), CalcAssembler::createTupleData(), BTreeHeapNodeAccessor::deallocateEntry(), LhxPartitionReader::demandData(), BTreeNodeAccessor::dumpNode(), UncollectExecStream::execute(), ExecStreamBufAccessor::getConsumptionTuplesAvailable(), ExternalSortMerger::heapify(), LcsRowScanExecStream::initializeFiltersIfNeeded(), BTreeWriter::insertTupleFromBuffer(), BTreeBuildLevel::processInput(), BarrierExecStream::processInputTuple(), ExternalSortRunLoader::quickSortFindPivot(), ExternalSortRunLoader::quickSortPartition(), FtrsTableWriter::redoLogicalAction(), LhxHashKeyAccessor::setCurrent(), LhxHashDataAccessor::setCurrent(), LbmSearchExecStream::setLowerBoundKey(), BTreePrefetchSearchExecStream::setLowerBoundKey(), TestCalculator::setUp(), BTreePrefetchSearchExecStream::setUpSearchKey(), ExecStreamBufAccessor::spanWholeTuples(), BTreeWriter::splitCurrentNode(), TupleTest::testDebugAccess(), LbmSearchTest::testScanIdx(), LbmUnionExecStreamTest::testUnion(), ExecStreamScheduler::traceStreamBufferContents(), tupleFiddle(), unitTestBool(), unitTestFloat(), unitTestLong(), unitTestNullableLocal(), unitTestPointer(), unitTestPointerCache(), unitTestStatusRegister(), unitTestWarnings(), BTreeReadersTest::unmarshalLeafRecord(), BTreeTest::unmarshalRecord(), and ExecStreamUnitTestBase::verifyBufferedOutput().

| void TupleAccessor::resetCurrentTupleBuf | ( | | ) | | ---------------------------------------- | - | | - |

| uint TupleAccessor::getCurrentByteCount | ( | | ) | const [inline] | | ---------------------------------------------------------------------------------------------------- | - | | - | ---------------- |

Determines the number of bytes stored in the current tuple buffer.

This will always be greater than or equal to getMinByteCount() and less than getMaxByteCount().

Returns:

byte count

Definition at line 348 of file TupleAccessor.h.

References getBufferByteCount(), and pTupleBuf.

Referenced by BTreeNodeAccessor::compactNode(), LcsClusterAppendExecStream::compress(), ExecStreamBufAccessor::consumeTuple(), ReshapeExecStream::copyCompareTuple(), BTreeHeapNodeAccessor::deallocateEntry(), BTreeWriter::deleteCurrent(), FtrsTableWriterExecStream::execute(), FtrsTableWriter::execute(), BTreeSortExecStream::execute(), UncollectExecStream::execute(), MockResourceExecStream::execute(), BarrierExecStream::execute(), LbmSplicerExecStreamTest::generateRidInput(), LbmSplicerExecStreamTest::generateTupleInput(), ExecStreamBufAccessor::getConsumptionTuplesAvailable(), LcsRowScanExecStream::initializeFiltersIfNeeded(), BTreeWriter::insertTupleFromBuffer(), BTreeBuildLevel::processInput(), LcsRowScanExecStreamTest::produceEntry(), LbmExecStreamTestBase::produceEntry(), ExecStreamBufAccessor::produceTuple(), FtrsTableWriter::redoLogicalAction(), LcsRowScanExecStreamTest::setSearchKey(), LbmSearchTest::setSearchKey(), ExecStreamBufAccessor::spanWholeTuples(), BTreeWriter::splitCurrentNode(), BTreeNodeAccessor::splitNode(), BTreeTest::testBulkLoad(), LbmSplicerExecStreamTest::testLER5968(), LbmSplicerExecStreamTest::testLER6473(), TupleTest::testMarshal(), BTreeReadersTest::testReaders(), LbmSearchTest::testScanFullKey(), LbmSearchTest::testScanPartialKey(), ExecStreamScheduler::traceStreamBufferContents(), BTreeReadersTest::unmarshalLeafRecord(), BTreeTest::unmarshalRecord(), BTreeWriter::updateCurrent(), BTreeAccessBase::validateTupleSize(), and ExecStreamUnitTestBase::verifyBufferedOutput().

Determines the number of bytes stored in a tuple buffer without actually preparing to unmarshal it.

Parameters:

Returns:

byte count

Definition at line 415 of file TupleAccessor.cpp.

References alignRoundUp(), cbMaxStorage, format, iLastVarEndIndirectOffset, isFixedWidth(), referenceIndirectOffset(), and TUPLE_FORMAT_NETWORK.

Referenced by LhxPartitionReader::demandData(), ExternalSortRunAccessor::fetch(), ExternalSortOutput::fetch(), ExecStreamBufAccessor::getConsumptionAvailableBounded(), getCurrentByteCount(), ExternalSortRunLoader::loadRun(), and ExternalSortRunAccessor::storeRun().

uint TupleAccessor::getByteCount ( TupleData const & tuple ) const

Determines the number of bytes required to store a tuple without actually marshalling it.

Parameters:

Returns:

byte count

Definition at line 434 of file TupleAccessor.cpp.

References alignRoundUp(), cbMaxStorage, iFirstVarOffset, isFixedWidth(), and pVarWidthAttrIndices.

Referenced by LhxPartitionWriter::aggAndMarshalTuple(), LhxPartitionWriter::close(), LhxHashKeyAccessor::getDiskStorageSize(), LhxHashDataAccessor::getDiskStorageSize(), LhxHashKeyAccessor::getStorageSize(), LhxHashDataAccessor::getStorageSize(), BTreeWriter::grow(), BTreeBuildLevel::indexLastChild(), VariableBuildLevel::indexLastKey(), isBufferSufficient(), LhxPartitionWriter::marshalTuple(), ErrorSource::postError(), BTreePrefetchSearchExecStream::setSearchKeyData(), TupleTest::testMarshal(), BTreeWriter::updateCurrent(), and ExecStreamBufAccessor::validateTupleSize().

bool TupleAccessor::isBufferSufficient ( TupleData const & tuple,
uint cbBuffer
) const
void TupleAccessor::unmarshal ( TupleData & tuple,
uint iFirstDatum = 0
) const

Unmarshals the current tuple buffer, setting a tuple's values to reference the contents.

Parameters:

tuple the tuple which will be modified to reference the unmarshalled values
iFirstDatum 0-based index of TupleDatum at which to start writing to tuple (defaults to first TupleDatum); note that unmarshalling always starts with the first attribute

Definition at line 489 of file TupleAccessor.cpp.

References bAlignedVar, bitFields, AttributeAccessor::cbStorage, format, getAttributeAccessor(), getCurrentTupleBuf(), AttributeAccessor::iEndIndirectOffset, iFirstVarEndIndirectOffset, iFirstVarOffset, AttributeAccessor::iFixedOffset, AttributeAccessor::iNullBit, isMAXU(), AttributeAccessor::iValueBit, min(), ppAttributeAccessors, referenceIndirectOffset(), and TUPLE_FORMAT_NETWORK.

Referenced by TupleDataWithBuffer::computeAndAllocate(), ReshapeExecStream::copyCompareTuple(), CalcAssembler::createTupleData(), LbmEntryDump::dump(), BTreeNodeAccessor::dumpNode(), UncollectExecStream::execute(), LcsRowScanExecStream::initializeFiltersIfNeeded(), LhxHashKeyAccessor::matches(), BarrierExecStream::processInputTuple(), BTreeSearchExecStream::readSearchKey(), FtrsTableWriter::redoLogicalAction(), TupleDataWithBuffer::resetBuffer(), LbmSearchExecStream::setLowerBoundKey(), BTreePrefetchSearchExecStream::setLowerBoundKey(), TestCalculator::setUp(), BTreePrefetchSearchExecStream::setUpSearchKey(), BTreeTest::testInserts(), LbmSplicerExecStreamTest::testLER5968(), LbmSplicerExecStreamTest::testLER6473(), TupleTest::testMarshal(), BTreeTest::testScan(), BTreeReadersTest::testScan(), BTreeTest::testSearch(), BTreeReadersTest::testSearch(), LbmSplicerExecStreamTest::testSpliceRids(), LbmSplicerExecStreamTest::testSpliceWithKeys(), ExecStreamScheduler::traceStreamBufferContents(), tupleFiddle(), unitTestBool(), unitTestFloat(), unitTestLong(), unitTestNullableLocal(), unitTestPointer(), unitTestPointerCache(), unitTestStatusRegister(), unitTestWarnings(), BTreeReadersTest::unmarshalLeafRecord(), BTreeTest::unmarshalRecord(), LhxPartitionReader::unmarshalTuple(), ExecStreamBufAccessor::unmarshalTuple(), LhxHashKeyAccessor::unpack(), LhxHashDataAccessor::unpack(), BTreeAccessBase::validateTupleSize(), and ExecStreamUnitTestBase::verifyBufferedOutput().

Marshals a tuple's values into a buffer.

Parameters:

tuple the tuple to be marshalled
pTupleBuf the buffer into which to marshal, which also becomes the current tuple buffer

Definition at line 541 of file TupleAccessor.cpp.

References bAlignedVar, bitFields, TupleDatum::cbData, AttributeAccessor::cbStorage, format, getAttributeAccessor(), iBitFieldOffset, AttributeAccessor::iEndIndirectOffset, iFirstVarEndIndirectOffset, iFirstVarOffset, AttributeAccessor::iFixedOffset, AttributeAccessor::iNullBit, isMAXU(), AttributeAccessor::iValueBit, marshalOrder, AttributeAccessor::marshalValueData(), TupleDatum::pData, pTupleBuf, referenceIndirectOffset(), TUPLE_FORMAT_NETWORK, and TUPLE_MAGIC_NUMBER.

Referenced by LhxPartitionWriter::aggAndMarshalTuple(), LhxPartitionWriter::close(), LcsClusterAppendExecStream::compress(), FtrsTableWriterExecStream::execute(), SegBufferWriterExecStream::execute(), MockResourceExecStream::execute(), BarrierExecStream::execute(), LbmSplicerExecStreamTest::generateRidInput(), LbmSplicerExecStreamTest::generateTupleInput(), BTreeWriter::grow(), BTreeBuildLevel::indexLastChild(), VariableBuildLevel::indexLastKey(), BTreeReadersTest::marshalLeafRecord(), BTreeTest::marshalMultiKeyRecord(), BTreeTest::marshalRecord(), LhxPartitionWriter::marshalTuple(), LhxHashDataAccessor::pack(), LhxHashKeyAccessor::pack(), ErrorSource::postError(), LcsRowScanExecStreamTest::produceEntry(), LbmExecStreamTestBase::produceEntry(), ExecStreamBufAccessor::produceTuple(), LcsRowScanExecStreamTest::setSearchKey(), LbmSearchTest::setSearchKey(), BTreePrefetchSearchExecStream::setSearchKeyData(), BTreeWriter::splitCurrentNode(), CollectExecStreamTestSuite::testCollectInts(), LbmSplicerExecStreamTest::testLER5968(), LbmSplicerExecStreamTest::testLER6473(), TupleTest::testMarshal(), ExecStreamTestSuite::testMergeImplicitPullInputs(), ExecStreamTestSuite::testReshapeExecStream(), LbmSearchTest::testScanFullKey(), LbmSearchTest::testScanPartialKey(), and BTreeWriter::updateCurrent().

| uint TupleAccessor::size | ( | | ) | const [inline] | | ------------------------------------------------------------------------------------- | - | | - | ---------------- |

| boost::dynamic_bitset<FixedBuffer> const& TupleAccessor::getBitFields | ( | | ) | const [inline] | | --------------------------------------------------------------------------------------------------------------------------- | - | | - | ---------------- |

Resolves an indirect offset into a pointer to the data offset.

Parameters:

pTupleBuf target buffer
iIndirectOffset indirect offset within tuple image

Returns:

pointer to data offset

Definition at line 340 of file TupleAccessor.h.

00342 { 00343 return reinterpret_cast<StoredValueOffset *>( 00344 pTupleBuf + iIndirectOffset); 00345 }


Member Data Documentation

Permutation in which attributes should be marshalled; empty when !bAlignedVar, in which case attributes should be marshalled in logical order.

Definition at line 66 of file TupleAccessor.h.

Referenced by clear(), compute(), and marshal().

Precomputed offset for indirect offset of end of first variable-width attribute, or MAXU if there are no variable-width attributes.

Definition at line 92 of file TupleAccessor.h.

Referenced by compute(), marshal(), and unmarshal().

Constant value for true.

This is used as a singleton unmarshalling address for true boolean values (since we can't reference individual bits).

Definition at line 137 of file TupleAccessor.h.

Referenced by BitAccessor::unmarshalValue().

Constant value for false.

This is used as a singleton unmarshalling address for false boolean values (since we can't reference individual bits).

Definition at line 144 of file TupleAccessor.h.

Referenced by BitAccessor::unmarshalValue().


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


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