Fennel: TupleDescriptor Class Reference (original) (raw)

A TupleDescriptor specifies a vector of stored attributes, as explained in the design docs. More...

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

List of all members.

Public Member Functions
void projectFrom (TupleDescriptor const &tupleDescriptor, TupleProjection const &tupleProjection)
int compareTuplesKey (TupleData const &tuple1, TupleData const &tuple2, uint keyCount) const
int compareTuples (TupleData const &tuple1, TupleData const &tuple2) const
int compareTuples (TupleData const &tuple1, TupleProjection const &proj1, TupleData const &tuple2, TupleProjection const &proj2, bool *containsNullKey=NULL) const
void writePersistent (ByteOutputStream &) const
void readPersistent (ByteInputStream &, StoredTypeDescriptorFactory const &)
void visit (TupleData const &tuple, DataVisitor &dataVisitor, bool visitLengths) const
bool containsNullable () const
bool storageEqual (TupleDescriptor const &other) const
Performs a comparison only of type & size, not nullability.
TupleStorageByteLength getMaxByteCount () const

Detailed Description

A TupleDescriptor specifies a vector of stored attributes, as explained in the design docs.

The compareTuples[Key] methods return the standard zero, negative, or positive to indicate EQ, LT, GT. However, rather than returning -1 or 1 for LT/GT, they return the 1-based ordinal of the first non-equal column (negated if LT). This allows a caller to implement ORDER BY DESC without having to pass in ASC/DESC information.

Definition at line 89 of file TupleDescriptor.h.


Member Function Documentation

Definition at line 72 of file TupleDescriptor.cpp.

Referenced by BTreeAccessBase::BTreeAccessBase(), LhxHashTable::calculateSize(), LhxHashKeyAccessor::init(), ReshapeExecStream::initCompareData(), LbmExecStreamTestBase::initNormalizerExecStream(), LcsClusterReplaceExecStream::initTupleLoadParams(), LcsClusterAppendExecStream::initTupleLoadParams(), FtrsTableWriterFactory::loadIndex(), ExternalSortExecStreamImpl::prepare(), LbmNormalizerExecStream::prepare(), LhxJoinExecStream::prepare(), BTreeSearchExecStream::prepare(), ReshapeExecStream::prepare(), LcsRowScanExecStream::prepareResidualFilters(), LhxAggExecStream::setHashInfo(), LbmSortedAggExecStreamTest::testSortedAgg(), and BTreeBuilder::truncateExternal().

00075 { 00076 clear(); 00077 for (uint i = 0; i < tupleProjection.size(); ++i) { 00078 push_back(tupleDescriptor[tupleProjection[i]]); 00079 } 00080 }

int TupleDescriptor::compareTuplesKey ( TupleData const & tuple1,
TupleData const & tuple2,
uint keyCount
) const

Definition at line 137 of file TupleDescriptor.cpp.

References min(), and TupleDatum::pData.

Referenced by LbmEntry::compareEntry(), ReshapeExecStream::compareInput(), compareTuples(), LbmSplicerExecStream::findBTreeEntry(), LbmSplicerExecStream::getValidatedTuple(), BTreeSearchExecStream::testInterval(), and BTreePrefetchSearchExecStream::testNonLeafInterval().

00141 { 00142 assert(keyCount <= std::min(tuple1.size(), tuple2.size())); 00143 00144 for (uint i = 0; i < keyCount; ++i) { 00145 TupleDatum const &datum1 = tuple1[i]; 00146 TupleDatum const &datum2 = tuple2[i]; 00147
00148 if (!datum1.pData) { 00149 if (!datum2.pData) { 00150 continue; 00151 } 00152 return -(i + 1); 00153 } else if (!datum2.pData) { 00154 return (i + 1); 00155 } 00156 int c = (*this)[i].pTypeDescriptor->compareValues( 00157 datum1.pData, 00158 datum1.cbData, 00159 datum2.pData, 00160 datum2.cbData); 00161 if (c > 0) { 00162 return (i + 1); 00163 } else if (c < 0) { 00164 return -(i + 1); 00165 } 00166 } 00167 return 0; 00168 }

int TupleDescriptor::compareTuples ( TupleData const & tuple1,
TupleData const & tuple2
) const

Definition at line 82 of file TupleDescriptor.cpp.

References compareTuplesKey(), and min().

Referenced by LcsColumnReader::applyFilters(), BTreeKeyedNodeAccessor< NodeAccessor, KeyAccessor >::binarySearch(), BTreeWriter::checkMonotonicity(), BTreeSearchExecStream::checkNextKey(), BTreeKeyedNodeAccessor< NodeAccessor, KeyAccessor >::compareFirstKey(), ReshapeExecStream::compareInput(), ExternalSortInfo::compareKeys(), LcsColumnReader::findVal(), LcsCompareColKeyUsingOffsetIndex::lessThan(), LhxHashKeyAccessor::matches(), LcsHash::search(), BTreeSearchExecStream::testInterval(), BTreePrefetchSearchExecStream::testNonLeafInterval(), LbmReaderTest::testSingleTupleReader(), ExecStreamUnitTestBase::verifyBufferedOutput(), and BTreeVerifier::verifyNode().

00085 { 00086 int keyComp; 00087
00088 size_t keyCount = std::min(tuple1.size(),tuple2.size()); 00089 keyCount = std::min(keyCount,size()); 00090 keyComp = compareTuplesKey(tuple1, tuple2, keyCount); 00091 return keyComp; 00092 }

Definition at line 94 of file TupleDescriptor.cpp.

References min(), and TupleDatum::pData.

00098 { 00099 size_t keyCount = std::min(proj1.size(), proj2.size()); 00100 00101 if (containsNullKey) { 00102 *containsNullKey = false; 00103 } 00104 for (uint i = 0; i < keyCount; ++i) { 00105 TupleDatum const &datum1 = tuple1[proj1[i]]; 00106 TupleDatum const &datum2 = tuple2[proj2[i]]; 00107
00108 if (!datum1.pData) { 00109 if (containsNullKey) { 00110 *containsNullKey = true; 00111 } 00112 if (!datum2.pData) { 00113 continue; 00114 } 00115 return -(i + 1); 00116 } else if (!datum2.pData) { 00117 if (containsNullKey) { 00118 *containsNullKey = true; 00119 } 00120 return (i + 1); 00121 } 00122 int c = (*this)[i].pTypeDescriptor->compareValues( 00123 datum1.pData, 00124 datum1.cbData, 00125 datum2.pData, 00126 datum2.cbData); 00127 if (c > 0) { 00128 return (i + 1); 00129 } else if (c < 0) { 00130 return -(i + 1); 00131 } 00132 } 00133 return 0; 00134 00135 }

void TupleDescriptor::visit ( TupleData const & tuple,
DataVisitor & dataVisitor,
bool visitLengths
) const

| bool TupleDescriptor::containsNullable | ( | | ) | const | | -------------------------------------- | - | | - | ----- |


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