MCPcopy Create free account
hub / github.com/bytedance/bolt / checkVectorFlagsReset

Function checkVectorFlagsReset

bolt/vector/tests/VectorTestUtils.cpp:269–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269void 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

Callers 2

TEST_FFunction · 0.85
TEST_FFunction · 0.85

Calls 7

getUpdatedAsciiRowsFunction · 0.85
checkVectorFlagsSetFunction · 0.85
checkVectorFlagsClearedFunction · 0.85
isFlatFunction · 0.70
nullsMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected