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

Method readArrowValueAtOffset

src/storage/table/arrow_rel_table.cpp:556–583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

554}
555
556bool ArrowRelTable::readArrowValueAtOffset(const ArrowSchemaWrapper& arrowSchema,
557 const std::vector<ArrowArrayWrapper>& arrowArrays, const std::vector<size_t>& startOffsets,
558 int64_t columnIdx, offset_t rowOffset, ValueVector& outputVector, uint64_t dstOffset) const {
559 if (columnIdx < 0 || arrowArrays.empty() || startOffsets.size() != arrowArrays.size()) {
560 return false;
561 }
562 for (size_t batchIdx = 0; batchIdx < arrowArrays.size(); ++batchIdx) {
563 const auto& batch = arrowArrays[batchIdx];
564 auto batchLength = getArrowBatchLength(batch);
565 auto batchStart = startOffsets[batchIdx];
566 if (rowOffset < batchStart || rowOffset >= batchStart + batchLength) {
567 continue;
568 }
569 auto rowInBatch = rowOffset - batchStart;
570 auto numChildren = batch.n_children < 0 ? 0u : static_cast<uint64_t>(batch.n_children);
571 if (static_cast<uint64_t>(columnIdx) >= numChildren || !batch.children ||
572 !arrowSchema.children || !batch.children[columnIdx] ||
573 !arrowSchema.children[columnIdx]) {
574 return false;
575 }
576 auto* childArray = batch.children[columnIdx];
577 auto* childSchema = arrowSchema.children[columnIdx];
578 readSingleArrowValue(childSchema, childArray, outputVector, childArray->offset + rowInBatch,
579 dstOffset);
580 return true;
581 }
582 return false;
583}
584
585std::vector<int64_t> ArrowRelTable::getOutputToArrowColumnIdx(
586 const std::vector<column_id_t>& columnIDs) const {

Callers

nothing calls this directly

Calls 4

readSingleArrowValueFunction · 0.85
getArrowBatchLengthFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected