Fennel: /home/pub/open/dev/fennel/hashexe/LhxAggExecStream.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
00023 #ifndef Fennel_LhxAggExecStream_Included
00024 #define Fennel_LhxAggExecStream_Included
00025
00026 #include "fennel/exec/ConduitExecStream.h"
00027 #include "fennel/exec/SortedAggExecStream.h"
00028 #include "fennel/hashexe/LhxHashBase.h"
00029 #include "fennel/hashexe/LhxHashTable.h"
00030 #include "fennel/hashexe/LhxPartition.h"
00031
00032 FENNEL_BEGIN_NAMESPACE
00033
00034
00035
00039 struct LhxAggExecStreamParams : public SortedAggExecStreamParams
00040 {
00044 SharedSegment pTempSegment;
00045
00049 bool enableSubPartStat;
00050
00055 uint forcePartitionLevel;
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00074 RecordNum cndGroupByKeys;
00075
00079 RecordNum numRows;
00080 };
00081
00090 class FENNEL_HASHEXE_EXPORT LhxAggExecStream
00091 : public ConduitExecStream
00092 {
00093
00094
00095
00096 enum LhxAggState {
00097 ForcePartitionBuild, Build, Produce, ProducePending,
00098 Partition, CreateChildPlan, GetNextPlan, Done
00099 };
00100
00104 TupleData inputTuple;
00105
00109 TupleData outputTuple;
00110
00111
00112
00113
00117 uint numTuplesProduced;
00118
00122 LhxHashInfo hashInfo;
00123
00127 LhxHashTable hashTable;
00128 LhxHashTableReader hashTableReader;
00129
00133 BlockNum numBlocksHashTable;
00134
00139 BlockNum numMiscCacheBlocks;
00140
00141
00142
00143
00144
00145
00146
00147
00148 bool isTopPlan;
00149 SharedLhxPlan rootPlan;
00150
00151
00152
00153
00154
00155 LhxPlan *curPlan;
00156
00157
00158
00159
00160
00164 uint buildInputIndex;
00165
00169 LhxPartitionInfo partInfo;
00170
00174 SharedLhxPartition buildPart;
00175
00179 LhxPartitionReader buildReader;
00180
00184 bool enableSubPartStat;
00185
00190 uint forcePartitionLevel;
00191
00195 LhxAggState aggState;
00196
00197
00198
00199
00203 LhxAggState nextState;
00204
00205
00206
00207
00208
00209
00210
00211 uint groupByKeyCount;
00212
00213
00214
00215
00216
00217 AggComputerList aggComputers;
00218 AggComputerList partialAggComputers;
00219
00220
00221 virtual void closeImpl();
00222
00223
00224
00225
00226 void setHashInfo(LhxAggExecStreamParams const ¶ms);
00227
00228
00229
00230
00231
00232 void setAggComputers(
00233 LhxHashInfo &hashInfo,
00234 AggInvocationList const &aggInvocations);
00235
00236 public:
00237
00238 virtual void prepare(LhxAggExecStreamParams const ¶ms);
00239 virtual void open(bool restart);
00240 virtual ExecStreamResult execute(ExecStreamQuantum const &quantum);
00241
00242 virtual void getResourceRequirements(
00243 ExecStreamResourceQuantity &minQuantity,
00244 ExecStreamResourceQuantity &optQuantity,
00245 ExecStreamResourceSettingType &optType);
00246
00247 virtual void setResourceAllocation(
00248 ExecStreamResourceQuantity &quantity);
00249
00250 };
00251
00252 FENNEL_END_NAMESPACE
00253
00254 #endif
00255
00256