Fennel: /home/pub/open/dev/fennel/lucidera/colstore/LcsColumnReader.h Source File (original) (raw)

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 #ifndef Fennel_LcsColumnReader_Included 00023 #define Fennel_LcsColumnReader_Included 00024 00025 #include "fennel/lucidera/colstore/LcsClusterNode.h" 00026 #include "fennel/lucidera/colstore/LcsBitOps.h" 00027 #include "fennel/lucidera/colstore/LcsResidualColumnFilters.h" 00028 00029 00030 FENNEL_BEGIN_NAMESPACE 00031 00035 class FENNEL_LCS_EXPORT LcsColumnReader 00036 : public boost::noncopyable 00037 { 00041 LcsClusterReader *pScan; 00042 00046 uint colOrd; 00047 00051 PLcsBatchDir pBatch; 00052 00056 PBuffer pValues; 00057 00061 PBuffer pBase; 00062 00066 PtrVec origin; 00067 00071 WidthVec width; 00072 00073
00074 00075 uint iV; 00076 00080 PBitVecFuncPtr pFuncReadBitVec; 00081 00086 const PBuffer (LcsColumnReader:: *pGetCurrentValueFunc) (); 00087 00091 LcsResidualColumnFilters filters; 00092 00096 TupleProjection allProj; 00097 00101 const PBuffer getCompressedValue(); 00102 00106 const PBuffer getFixedValue(); 00107 00111 const PBuffer getVariableValue(); 00112 00128 uint findVal( 00129 uint filterPos, 00130 bool highBound, 00131 bool bStrict, 00132 TupleDataWithBuffer &readerKeyData); 00133 00146 void findBounds( 00147 uint filterPos, 00148 uint &nLoVal, 00149 uint &nHiVal, 00150 TupleDataWithBuffer &readerKeyData); 00151 00155 void buildContainsMap(); 00156 00157 public: 00165 void init(LcsClusterReader *pScanInit, uint colOrdInit) 00166 { 00167 pScan = pScanInit; 00168 colOrd = colOrdInit; 00169 filters.hasResidualFilters = false; 00170 filters.filterDataInitialized = false; 00171 allProj.push_back(0); 00172 } 00173 00178 void sync(); 00179 00183 bool batchIsCompressed() const 00184 { 00185 return pBatch->mode == LCS_COMPRESSED; 00186 } 00187 00191 bool batchIsFixed() const 00192 { 00193 return pBatch->mode == LCS_FIXED; 00194 } 00195 00199 const PBuffer getCurrentValue() 00200 { 00201 return (this->*pGetCurrentValueFunc)(); 00202 } 00203 00208 uint16_t getCurrentValueCode() const; 00209 00210
00211
00212
00213
00217 uint getBatchValCount() const 00218 { 00219 return pBatch->nVal; 00220 } 00221 00225 const PBuffer getBatchBase() const 00226 { 00227 return pBase; 00228 } 00229 00233 const uint16_t *getBatchOffsets() const 00234 { 00235 return (const uint16_t *) pValues; 00236 } 00237 00243 const PBuffer getBatchValue(uint iValCode) const 00244 { 00245 return (const PBuffer) (getBatchBase() + getBatchOffsets()[iValCode]); 00246 } 00247 00265 void readCompressedBatch(uint count, uint16_t *pValCodes, uint *pActCount); 00266 00270 struct LcsResidualColumnFilters& getFilters() 00271 { 00272 return filters; 00273 } 00274 00284 bool applyFilters( 00285 TupleDescriptor &projDescriptor, 00286 TupleData &outputTupleData); 00287 }; 00288 00289 FENNEL_END_NAMESPACE 00290 00291 #endif 00292 00293