Inheritance diagram for SortedAggExecStreamGenerator:
Public Member Functions | |
SortedAggExecStreamGenerator (uint nRows, uint nKeys, std::vector< int > repeatSeqValues) | |
virtual int64_t | generateValue (uint iRow, uint iCol) |
Generates one data value. | |
Protected Attributes | |
uint | nRows |
uint | nKeys |
std::vector< int > | keyRepeats |
uint | interval |
boost::shared_array< uint > | sortedToUnsortedMap |
int | current |
boost::shared_array< uint > | currentRow |
0, 0, 0, 23 [row 0] 0, 0, 1, 22 [row 1] ...
Definition at line 94 of file LbmSortedAggExecStreamTest.cpp.
SortedAggExecStreamGenerator::SortedAggExecStreamGenerator | ( | uint | nRows, | |
uint | nKeys, | |||
std::vector< int > | repeatSeqValues | |||
) | [inline] |
Definition at line 106 of file LbmSortedAggExecStreamTest.cpp.
References current, currentRow, LbmExecStreamTestBase::getTupleInterval(), interval, keyRepeats, and sortedToUnsortedMap.
00108 { 00109 this->nRows = nRows; 00110 this->nKeys = nKeys; 00111 for (uint i = 0; i < nKeys; i++) { 00112 keyRepeats.push_back(repeatSeqValues[i]); 00113 } 00114 interval = LbmExecStreamTestBase::getTupleInterval(keyRepeats); 00115 00116 sortedToUnsortedMap.reset(new uint[interval]); 00117 for (uint i = 0; i < interval; i++) { 00118 uint value = 0; 00119 uint scale = 1; 00120 // calculate sorted position (backwards) 00121 // value = key0 * scale_1_to_n + key1 * scale_2_to_n + ... 00122 for (int j = nKeys - 1; j >= 0; j--) { 00123 uint key = i % keyRepeats[j]; 00124 value += key * scale; 00125 scale *= keyRepeats[j]; 00126 } 00127 sortedToUnsortedMap[value] = i; 00128 } 00129 current = -1; 00130 currentRow.reset(new uint[nKeys + 1]); 00131 }
virtual int64_t SortedAggExecStreamGenerator::generateValue | ( | uint | iRow, | |
uint | iCol | |||
) | [inline, virtual] |
Generates one data value.
iRow | 0-based row number to generate | |
iCol | 0-based col number to generate |
Implements MockProducerExecStreamGenerator.
Definition at line 133 of file LbmSortedAggExecStreamTest.cpp.
References current, currentRow, getValueCount(), interval, keyRepeats, nKeys, nRows, and sortedToUnsortedMap.
00134 { 00135 assert (iRow < interval); 00136 assert (iCol < nKeys + 1); 00137 00138 if (iRow != current) { 00139 current = iRow; 00140 uint unsorted = sortedToUnsortedMap[current]; 00141 for (uint i = 0; i < nKeys; i++) { 00142 currentRow[i] = unsorted % keyRepeats[i]; 00143 } 00144 currentRow[nKeys] = getValueCount(nRows, interval, unsorted); 00145 } 00146 return currentRow[iCol]; 00147 }
uint SortedAggExecStreamGenerator::nRows [protected] |
uint SortedAggExecStreamGenerator::nKeys [protected] |
std::vector<int> SortedAggExecStreamGenerator::keyRepeats [protected] |
Definition at line 99 of file LbmSortedAggExecStreamTest.cpp.
Referenced by generateValue(), and SortedAggExecStreamGenerator().
uint SortedAggExecStreamGenerator::interval [protected] |
Definition at line 100 of file LbmSortedAggExecStreamTest.cpp.
Referenced by generateValue(), and SortedAggExecStreamGenerator().
boost::shared_array<uint> SortedAggExecStreamGenerator::sortedToUnsortedMap [protected] |
Definition at line 101 of file LbmSortedAggExecStreamTest.cpp.
Referenced by generateValue(), and SortedAggExecStreamGenerator().
int SortedAggExecStreamGenerator::current [protected] |
Definition at line 102 of file LbmSortedAggExecStreamTest.cpp.
Referenced by generateValue(), and SortedAggExecStreamGenerator().
boost::shared_array<uint> SortedAggExecStreamGenerator::currentRow [protected] |
Definition at line 103 of file LbmSortedAggExecStreamTest.cpp.
Referenced by generateValue(), and SortedAggExecStreamGenerator().