| 699 | } |
| 700 | |
| 701 | Status 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 | |
| 730 | template <class ArrayType> |
| 731 | Status WriteListBatch(const Array& array, int64_t orc_offset, |
no test coverage detected