|
27 | 27 | #include <arrow/array/array_primitive.h> |
28 | 28 | #include <arrow/array/builder_nested.h> |
29 | 29 | #include <arrow/array/builder_primitive.h> |
| 30 | +#include <arrow/array/util.h> |
| 31 | +#include <arrow/record_batch.h> |
30 | 32 | #include <TTree.h> |
31 | 33 | #include <TBranch.h> |
32 | 34 | #include <TFile.h> |
|
35 | 37 | #include <cstdint> |
36 | 38 | #include <memory> |
37 | 39 | #include <stdexcept> |
38 | | -#include <iostream> |
39 | 40 |
|
40 | 41 | O2_DECLARE_DYNAMIC_LOG(root_arrow_fs); |
41 | 42 |
|
@@ -729,26 +730,30 @@ arrow::Result<arrow::RecordBatchGenerator> TTreeFileFormat::ScanBatchesAsync( |
729 | 730 | std::shared_ptr<arrow::Array> array; |
730 | 731 |
|
731 | 732 | if (listType) { |
732 | | - auto varray = std::make_shared<arrow::PrimitiveArray>(datasetField->type()->field(0)->type(), valueOp.rootBranchEntries * valueOp.listSize, valueOp.targetBuffer); |
733 | | - array = std::make_shared<arrow::FixedSizeListArray>(datasetField->type(), valueOp.rootBranchEntries, varray); |
| 733 | + auto vdata = std::make_shared<arrow::ArrayData>(datasetField->type()->field(0)->type(), valueOp.rootBranchEntries * valueOp.listSize, |
| 734 | + std::vector<std::shared_ptr<arrow::Buffer>>{nullptr, valueOp.targetBuffer}); |
| 735 | + array = std::make_shared<arrow::FixedSizeListArray>(datasetField->type(), valueOp.rootBranchEntries, arrow::MakeArray(vdata)); |
734 | 736 | // This is a vla, there is also an offset op |
735 | 737 | O2_SIGNPOST_EVENT_EMIT(root_arrow_fs, tid, "Op", "Created op for branch %{public}s with %lli entries, size of the buffer %lli.", |
736 | 738 | valueOp.branch->GetName(), |
737 | 739 | valueOp.rootBranchEntries, |
738 | 740 | valueOp.targetBuffer->size()); |
739 | 741 | } else if (mapping.vlaIdx != -1) { |
740 | 742 | auto& offsetOp = ops[ops.size() - 2]; |
741 | | - auto varray = std::make_shared<arrow::PrimitiveArray>(datasetField->type()->field(0)->type(), offsetOp.offsetCount, valueOp.targetBuffer); |
| 743 | + auto vdata = std::make_shared<arrow::ArrayData>(datasetField->type()->field(0)->type(), offsetOp.offsetCount, |
| 744 | + std::vector<std::shared_ptr<arrow::Buffer>>{nullptr, valueOp.targetBuffer}); |
742 | 745 | // We have pushed an offset op if this was the case. |
743 | | - array = std::make_shared<arrow::ListArray>(datasetField->type(), offsetOp.rootBranchEntries, offsetOp.targetBuffer, varray); |
| 746 | + array = std::make_shared<arrow::ListArray>(datasetField->type(), offsetOp.rootBranchEntries, offsetOp.targetBuffer, arrow::MakeArray(vdata)); |
744 | 747 | O2_SIGNPOST_EVENT_EMIT(root_arrow_fs, tid, "Op", "Created op for branch %{public}s with %lli entries, size of the buffer %lli.", |
745 | 748 | offsetOp.branch->GetName(), offsetOp.rootBranchEntries, offsetOp.targetBuffer->size()); |
746 | 749 | O2_SIGNPOST_EVENT_EMIT(root_arrow_fs, tid, "Op", "Created op for branch %{public}s with %lli entries, size of the buffer %lli.", |
747 | 750 | valueOp.branch->GetName(), |
748 | 751 | offsetOp.offsetCount, |
749 | 752 | valueOp.targetBuffer->size()); |
750 | 753 | } else { |
751 | | - array = std::make_shared<arrow::PrimitiveArray>(datasetField->type(), valueOp.rootBranchEntries, valueOp.targetBuffer); |
| 754 | + auto data = std::make_shared<arrow::ArrayData>(datasetField->type(), valueOp.rootBranchEntries, |
| 755 | + std::vector<std::shared_ptr<arrow::Buffer>>{nullptr, valueOp.targetBuffer}); |
| 756 | + array = arrow::MakeArray(data); |
752 | 757 | O2_SIGNPOST_EVENT_EMIT(root_arrow_fs, tid, "Op", "Created op for branch %{public}s with %lli entries, size of the buffer %lli.", |
753 | 758 | valueOp.branch->GetName(), |
754 | 759 | valueOp.rootBranchEntries, |
|
0 commit comments