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

Function WriteListBatch

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

Source from the content-addressed store, hash-verified

731
732template <class ArrayType>
733Status WriteListBatch(const Array& array, int64_t orc_offset,
734 liborc::ColumnVectorBatch* column_vector_batch) {
735 const ArrayType& list_array(checked_cast<const ArrayType&>(array));
736 auto batch = checked_cast<liborc::ListVectorBatch*>(column_vector_batch);
737 liborc::ColumnVectorBatch* element_batch = (batch->elements).get();
738 int64_t arrow_length = array.length();
739 int64_t running_arrow_offset = 0, running_orc_offset = orc_offset;
740 if (orc_offset == 0) {
741 batch->offsets[0] = 0;
742 }
743 if (array.null_count()) {
744 batch->hasNulls = true;
745 }
746 for (; running_arrow_offset < arrow_length;
747 running_orc_offset++, running_arrow_offset++) {
748 if (array.IsNull(running_arrow_offset)) {
749 batch->notNull[running_orc_offset] = false;
750 batch->offsets[running_orc_offset + 1] = batch->offsets[running_orc_offset];
751 } else {
752 batch->notNull[running_orc_offset] = true;
753 batch->offsets[running_orc_offset + 1] =
754 batch->offsets[running_orc_offset] +
755 list_array.value_offset(running_arrow_offset + 1) -
756 list_array.value_offset(running_arrow_offset);
757 element_batch->resize(batch->offsets[running_orc_offset + 1]);
758 int64_t subarray_arrow_offset = list_array.value_offset(running_arrow_offset),
759 subarray_orc_offset = batch->offsets[running_orc_offset],
760 subarray_orc_length =
761 batch->offsets[running_orc_offset + 1] - subarray_orc_offset;
762 RETURN_NOT_OK(WriteBatch(
763 *(list_array.values()->Slice(subarray_arrow_offset, subarray_orc_length)),
764 subarray_orc_offset, element_batch));
765 }
766 }
767 return Status::OK();
768}
769
770Status WriteMapBatch(const Array& array, int64_t orc_offset,
771 liborc::ColumnVectorBatch* column_vector_batch) {

Callers

nothing calls this directly

Calls 10

resizeMethod · 0.80
WriteBatchFunction · 0.70
OKFunction · 0.50
getMethod · 0.45
lengthMethod · 0.45
null_countMethod · 0.45
IsNullMethod · 0.45
value_offsetMethod · 0.45
SliceMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected