| 267 | } |
| 268 | |
| 269 | void checkVectorFlagsReset( |
| 270 | const std::function<VectorPtr()>& createVector, |
| 271 | const std::function<void(VectorPtr&)>& makeMutable, |
| 272 | const SelectivityVector& mutatedRows) { |
| 273 | // Vector is multiply-referenced. |
| 274 | auto vector = createVector(); |
| 275 | auto asciiRows = createAllSelectedAsciiRows(vector); |
| 276 | // Mutation of dictionary or constant vectors is expected to create a new |
| 277 | // vector that doesn't keep the asciiness information. |
| 278 | auto updatedAsciiRows = isFlat(vector) |
| 279 | ? getUpdatedAsciiRows(asciiRows, mutatedRows) |
| 280 | : SelectivityVector{}; |
| 281 | checkVectorFlagsSet(*vector, asciiRows); |
| 282 | auto another = vector; |
| 283 | makeMutable(vector); |
| 284 | // When vector is multiply-referenced, mutation will create a new vector and |
| 285 | // hence not expected to keep the asciiness information. |
| 286 | checkVectorFlagsCleared(*vector, mutatedRows, {}); |
| 287 | |
| 288 | // nulls buffer is multiply-referenced. |
| 289 | vector = createVector(); |
| 290 | checkVectorFlagsSet(*vector, asciiRows); |
| 291 | auto nulls = vector->nulls(); |
| 292 | makeMutable(vector); |
| 293 | checkVectorFlagsCleared(*vector, mutatedRows, updatedAsciiRows); |
| 294 | |
| 295 | // values buffer is multiply-referenced. |
| 296 | vector = createVector(); |
| 297 | if (vector->isFlatEncoding()) { |
| 298 | checkVectorFlagsSet(*vector, asciiRows); |
| 299 | auto values = vector->values(); |
| 300 | makeMutable(vector); |
| 301 | checkVectorFlagsCleared(*vector, mutatedRows, updatedAsciiRows); |
| 302 | } |
| 303 | |
| 304 | vector = createVector(); |
| 305 | checkVectorFlagsSet(*vector, asciiRows); |
| 306 | makeMutable(vector); |
| 307 | checkVectorFlagsCleared(*vector, mutatedRows, updatedAsciiRows); |
| 308 | } |
| 309 | |
| 310 | } // namespace bytedance::bolt::test |
no test coverage detected