Returns an uninitialized SelectivityVector from a pool. Allocates new one if none is available. Make sure to call 'releaseSelectivityVector' when done using the vector to allow for reuse. Prefer using LocalSelectivityVector which takes care of returning the vector to the pool on destruction.
| 281 | /// Prefer using LocalSelectivityVector which takes care of returning the |
| 282 | /// vector to the pool on destruction. |
| 283 | std::unique_ptr<SelectivityVector> getSelectivityVector(int32_t size) { |
| 284 | BOLT_CHECK(exprEvalCacheEnabled_ || selectivityVectorPool_.empty()); |
| 285 | if (selectivityVectorPool_.empty()) { |
| 286 | return std::make_unique<SelectivityVector>(size); |
| 287 | } |
| 288 | auto vector = std::move(selectivityVectorPool_.back()); |
| 289 | selectivityVectorPool_.pop_back(); |
| 290 | vector->resizeFill(size); |
| 291 | return vector; |
| 292 | } |
| 293 | |
| 294 | // Returns an arbitrary SelectivityVector with undefined |
| 295 | // content. The caller is responsible for setting the size and |