| 201 | } |
| 202 | |
| 203 | RowVectorPtr FilterProject::getOutput() { |
| 204 | if (allInputProcessed()) { |
| 205 | return nullptr; |
| 206 | } |
| 207 | |
| 208 | vector_size_t size = input_->size(); |
| 209 | bool isCompositeInput = RowVector::isComposite(input_); |
| 210 | |
| 211 | #ifdef SPARK_COMPATIBLE |
| 212 | if (skipForCompositeInput_ && isCompositeInput) { |
| 213 | BOLT_CHECK(!hasFilter_ && !isIdentityProjection_); |
| 214 | numProcessedInputRows_ = size; |
| 215 | return fillCompositeOutput(size, input_->children()); |
| 216 | } |
| 217 | #endif |
| 218 | |
| 219 | LocalSelectivityVector localRows(*operatorCtx_->execCtx(), size); |
| 220 | auto* rows = localRows.get(); |
| 221 | BOLT_DCHECK_NOT_NULL(rows) |
| 222 | rows->setAll(); |
| 223 | EvalCtx evalCtx( |
| 224 | operatorCtx_->execCtx(), |
| 225 | exprs_.get(), |
| 226 | input_.get(), |
| 227 | driverCtx_->currentSplitStr, |
| 228 | acceptCompositeInput_); |
| 229 | |
| 230 | // Pre-load lazy vectors which are referenced by both expressions and identity |
| 231 | // projections. |
| 232 | for (auto fieldIdx : multiplyReferencedFieldIndices_) { |
| 233 | evalCtx.ensureFieldLoaded(fieldIdx, *rows); |
| 234 | } |
| 235 | |
| 236 | if (!hasFilter_) { |
| 237 | numProcessedInputRows_ = size; |
| 238 | BOLT_CHECK(!isIdentityProjection_); |
| 239 | auto results = project(*rows, evalCtx); |
| 240 | if (isCompositeInput) { |
| 241 | return fillCompositeOutput(size, results); |
| 242 | } else { |
| 243 | return fillOutput(size, nullptr, results); |
| 244 | } |
| 245 | } |
| 246 | BOLT_CHECK(!isCompositeInput); |
| 247 | |
| 248 | // evaluate filter |
| 249 | auto numOut = filter(evalCtx, *rows); |
| 250 | numProcessedInputRows_ = size; |
| 251 | if (numOut == 0) { // no rows passed the filer |
| 252 | input_ = nullptr; |
| 253 | return nullptr; |
| 254 | } |
| 255 | |
| 256 | bool allRowsSelected = (numOut == size); |
| 257 | |
| 258 | // evaluate projections (if present) |
| 259 | std::vector<VectorPtr> results; |
| 260 | if (!isIdentityProjection_) { |
nothing calls this directly
no test coverage detected