MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / scanArrowArrayDenseUnion

Function scanArrowArrayDenseUnion

src/common/arrow/arrow_array_scan.cpp:303–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303static void scanArrowArrayDenseUnion(const ArrowSchema* schema, const ArrowArray* array,
304 ValueVector& outputVector, ArrowNullMaskTree* mask, uint64_t srcOffset, uint64_t dstOffset,
305 uint64_t count) {
306 auto types = ((const uint8_t*)array->buffers[0]) + srcOffset;
307 auto dstTypes = (uint16_t*)UnionVector::getTagVector(&outputVector)->getData();
308 auto offsets = ((const int32_t*)array->buffers[1]) + srcOffset;
309 std::vector<int32_t> firstIncident(array->n_children, INT32_MAX);
310
311 mask->copyToValueVector(&outputVector, dstOffset, count);
312
313 rowIter(outputVector, count, [&](auto i) {
314 auto curType = types[i];
315 auto curOffset = offsets[i];
316 if (curOffset < firstIncident[curType]) {
317 firstIncident[curType] = curOffset;
318 }
319 if (!mask->isNull(i)) {
320 dstTypes[i] = curType;
321 auto childOffset =
322 mask->getChild(curType)->offsetBy(curOffset - firstIncident[curType]);
323 ArrowConverter::fromArrowArray(schema->children[curType], array->children[curType],
324 *UnionVector::getValVector(&outputVector, curType), &childOffset,
325 curOffset + array->children[curType]->offset, i + dstOffset, 1);
326 // may be inefficient, since we're only scanning a single value
327 }
328 });
329}
330
331static void scanArrowArraySparseUnion(const ArrowSchema* schema, const ArrowArray* array,
332 ValueVector& outputVector, ArrowNullMaskTree* mask, uint64_t srcOffset, uint64_t dstOffset,

Callers 1

fromArrowArrayMethod · 0.85

Calls 6

rowIterFunction · 0.85
copyToValueVectorMethod · 0.80
offsetByMethod · 0.80
getDataMethod · 0.45
isNullMethod · 0.45
getChildMethod · 0.45

Tested by

no test coverage detected