00001 /* 00002 // $Id: //open/dev/fennel/lucidera/colstore/LcsRowScanBaseExecStream.h#12 $ 00003 // Fennel is a library of data storage and processing components. 00004 // Copyright (C) 2006-2009 LucidEra, Inc. 00005 // Copyright (C) 2006-2009 The Eigenbase Project 00006 // 00007 // This program is free software; you can redistribute it and/or modify it 00008 // under the terms of the GNU General Public License as published by the Free 00009 // Software Foundation; either version 2 of the License, or (at your option) 00010 // any later version approved by The Eigenbase Project. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with this program; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #ifndef Fennel_LcsRowScanBaseExecStream_Included 00023 #define Fennel_LcsRowScanBaseExecStream_Included 00024 00025 #include "fennel/exec/ConfluenceExecStream.h" 00026 #include "fennel/ftrs/BTreeExecStream.h" 00027 #include "fennel/tuple/TupleDescriptor.h" 00028 #include "fennel/tuple/TupleDataWithBuffer.h" 00029 #include "fennel/tuple/UnalignedAttributeAccessor.h" 00030 #include "fennel/common/CircularBuffer.h" 00031 #include "fennel/lucidera/colstore/LcsClusterReader.h" 00032 00033 FENNEL_BEGIN_NAMESPACE 00034 00038 struct LcsClusterScanDef : public BTreeExecStreamParams 00039 { 00043 TupleDescriptor clusterTupleDesc; 00044 }; 00045 00046 typedef std::vector<LcsClusterScanDef> LcsClusterScanDefList; 00047 00052 struct LcsRowScanBaseExecStreamParams : public ConfluenceExecStreamParams 00053 { 00057 LcsClusterScanDefList lcsClusterScanDefs; 00058 00062 TupleProjection outputProj; 00063 }; 00064 00065 00069 class FENNEL_LCS_EXPORT LcsRowScanBaseExecStream 00070 : public ConfluenceExecStream 00071 { 00072 protected: 00077 VectorOfUint projMap; 00078 00082 uint nClusters; 00083 00087 boost::scoped_array<SharedLcsClusterReader> pClusters; 00088 00092 TupleDescriptor projDescriptor; 00093 00097 std::vector<int> nonClusterCols; 00098 00103 bool allSpecial; 00104 00108 CircularBuffer<LcsRidRun> ridRuns; 00109 00115 void syncColumns(SharedLcsClusterReader &pScan); 00116 00120 std::vector<UnalignedAttributeAccessor> attrAccessors; 00121 00132 bool readColVals( 00133 SharedLcsClusterReader &pScan, 00134 TupleDataWithBuffer &tupleData, 00135 uint colStart); 00136 00145 virtual void buildOutputProj( 00146 TupleProjection &outputProj, 00147 LcsRowScanBaseExecStreamParams const ¶ms); 00148 00149 public: 00150 explicit LcsRowScanBaseExecStream(); 00151 virtual void prepare(LcsRowScanBaseExecStreamParams const ¶ms); 00152 virtual void open(bool restart); 00153 virtual void getResourceRequirements( 00154 ExecStreamResourceQuantity &minQuantity, 00155 ExecStreamResourceQuantity &optQuantity); 00156 virtual void closeImpl(); 00157 }; 00158 00162 enum LcsSpecialColumnId { 00163 LCS_RID_COLUMN_ID = 0x7FFFFF00 00164 }; 00165 00166 FENNEL_END_NAMESPACE 00167 00168 #endif 00169 00170 // End LcsRowScanBaseExecStream.h