MCPcopy Create free account
hub / github.com/apache/arrow / WriteStructBatch

Function WriteStructBatch

cpp/src/arrow/adapters/orc/util.cc:701–728  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

699}
700
701Status WriteStructBatch(const Array& array, int64_t orc_offset,
702 liborc::ColumnVectorBatch* column_vector_batch) {
703 std::shared_ptr<Array> array_ = MakeArray(array.data());
704 std::shared_ptr<StructArray> struct_array(checked_pointer_cast<StructArray>(array_));
705 auto batch = checked_cast<liborc::StructVectorBatch*>(column_vector_batch);
706 std::size_t size = array.type()->fields().size();
707 int64_t arrow_length = array.length();
708 int64_t running_arrow_offset = 0, running_orc_offset = orc_offset;
709 // First fill fields of ColumnVectorBatch
710 if (array.null_count()) {
711 batch->hasNulls = true;
712 }
713 for (; running_arrow_offset < arrow_length;
714 running_orc_offset++, running_arrow_offset++) {
715 if (array.IsNull(running_arrow_offset)) {
716 batch->notNull[running_orc_offset] = false;
717 } else {
718 batch->notNull[running_orc_offset] = true;
719 }
720 }
721 // Fill the fields
722 for (std::size_t i = 0; i < size; i++) {
723 batch->fields[i]->resize(orc_offset + arrow_length);
724 RETURN_NOT_OK(WriteBatch(*(struct_array->field(static_cast<int>(i))), orc_offset,
725 batch->fields[i]));
726 }
727 return Status::OK();
728}
729
730template <class ArrayType>
731Status WriteListBatch(const Array& array, int64_t orc_offset,

Callers 1

WriteBatchFunction · 0.85

Calls 12

resizeMethod · 0.80
WriteBatchFunction · 0.70
MakeArrayFunction · 0.50
OKFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45
fieldsMethod · 0.45
typeMethod · 0.45
lengthMethod · 0.45
null_countMethod · 0.45
IsNullMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected