| 183 | } // namespace |
| 184 | |
| 185 | void GroupingSet::addInput(const RowVectorPtr& input, bool mayPushdown) { |
| 186 | if (isGlobal_) { |
| 187 | addGlobalAggregationInput(input, mayPushdown); |
| 188 | return; |
| 189 | } |
| 190 | |
| 191 | auto numRows = input->size(); |
| 192 | numInputRows_ += numRows; |
| 193 | if (!preGroupedKeyChannels_.empty()) { |
| 194 | if (remainingInput_) { |
| 195 | addRemainingInput(); |
| 196 | } |
| 197 | // Look for the last group of pre-grouped keys. |
| 198 | for (auto i = input->size() - 2; i >= 0; --i) { |
| 199 | if (!equalKeys(preGroupedKeyChannels_, input, i, i + 1)) { |
| 200 | // Process that many rows, flush the accumulators and the hash |
| 201 | // table, then add remaining rows. |
| 202 | numRows = i + 1; |
| 203 | |
| 204 | remainingInput_ = input; |
| 205 | firstRemainingRow_ = numRows; |
| 206 | remainingMayPushdown_ = mayPushdown; |
| 207 | break; |
| 208 | } |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | activeRows_.resize(numRows); |
| 213 | activeRows_.setAll(); |
| 214 | |
| 215 | addInputForActiveRows(input, mayPushdown); |
| 216 | } |
| 217 | |
| 218 | void GroupingSet::noMoreInput() { |
| 219 | noMoreInput_ = true; |
no test coverage detected