From 173d0b9cf2ab35ce03026b73eb61b890d35647c6 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 28 May 2025 13:42:49 +0200 Subject: [PATCH] DPL: adapt to arrow 20.0.0 - A few implicit include statements now fixed. - Constructor of PrimitiveArray was moved to protected by upstream to solve issue https://github.com/apache/arrow/issues/45301. Adapt by using suggested workaround via MakeArray. --- Framework/AnalysisSupport/src/RNTuplePlugin.cxx | 13 ++++++++----- Framework/AnalysisSupport/src/TTreePlugin.cxx | 17 +++++++++++------ Framework/Core/src/EmptyFragment.cxx | 11 ++++++++--- Framework/Core/test/o2AO2DToAO3D.cxx | 1 + 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Framework/AnalysisSupport/src/RNTuplePlugin.cxx b/Framework/AnalysisSupport/src/RNTuplePlugin.cxx index 2c6fffe872db3..71719d712b6d3 100644 --- a/Framework/AnalysisSupport/src/RNTuplePlugin.cxx +++ b/Framework/AnalysisSupport/src/RNTuplePlugin.cxx @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #if __has_include() @@ -859,18 +861,19 @@ arrow::Result RNTupleFileFormat::ScanBatchesAsync( } switch (listSize) { case -1: { - auto varray = std::make_shared(physicalField->type()->field(0)->type(), totalSize, arrowValuesBuffer); - array = std::make_shared(physicalField->type(), readEntries, arrowOffsetBuffer, varray); + auto vdata = std::make_shared(physicalField->type()->field(0)->type(), totalSize, std::vector>{nullptr, arrowValuesBuffer}); + array = std::make_shared(physicalField->type(), readEntries, arrowOffsetBuffer, arrow::MakeArray(vdata)); } break; case 1: { totalSize = readEntries * listSize; - array = std::make_shared(physicalField->type(), readEntries, arrowValuesBuffer); + auto data = std::make_shared(physicalField->type(), readEntries, std::vector>{nullptr, arrowValuesBuffer}); + array = arrow::MakeArray(data); } break; default: { totalSize = readEntries * listSize; - auto varray = std::make_shared(physicalField->type()->field(0)->type(), totalSize, arrowValuesBuffer); - array = std::make_shared(physicalField->type(), readEntries, varray); + auto vdata = std::make_shared(physicalField->type()->field(0)->type(), totalSize, std::vector>{nullptr, arrowValuesBuffer}); + array = std::make_shared(physicalField->type(), readEntries, arrow::MakeArray(vdata)); } } } diff --git a/Framework/AnalysisSupport/src/TTreePlugin.cxx b/Framework/AnalysisSupport/src/TTreePlugin.cxx index 28fd713112c94..4a51f4eac68f6 100644 --- a/Framework/AnalysisSupport/src/TTreePlugin.cxx +++ b/Framework/AnalysisSupport/src/TTreePlugin.cxx @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include #include @@ -35,7 +37,6 @@ #include #include #include -#include O2_DECLARE_DYNAMIC_LOG(root_arrow_fs); @@ -729,8 +730,9 @@ arrow::Result TTreeFileFormat::ScanBatchesAsync( std::shared_ptr array; if (listType) { - auto varray = std::make_shared(datasetField->type()->field(0)->type(), valueOp.rootBranchEntries * valueOp.listSize, valueOp.targetBuffer); - array = std::make_shared(datasetField->type(), valueOp.rootBranchEntries, varray); + auto vdata = std::make_shared(datasetField->type()->field(0)->type(), valueOp.rootBranchEntries * valueOp.listSize, + std::vector>{nullptr, valueOp.targetBuffer}); + array = std::make_shared(datasetField->type(), valueOp.rootBranchEntries, arrow::MakeArray(vdata)); // This is a vla, there is also an offset op O2_SIGNPOST_EVENT_EMIT(root_arrow_fs, tid, "Op", "Created op for branch %{public}s with %lli entries, size of the buffer %lli.", valueOp.branch->GetName(), @@ -738,9 +740,10 @@ arrow::Result TTreeFileFormat::ScanBatchesAsync( valueOp.targetBuffer->size()); } else if (mapping.vlaIdx != -1) { auto& offsetOp = ops[ops.size() - 2]; - auto varray = std::make_shared(datasetField->type()->field(0)->type(), offsetOp.offsetCount, valueOp.targetBuffer); + auto vdata = std::make_shared(datasetField->type()->field(0)->type(), offsetOp.offsetCount, + std::vector>{nullptr, valueOp.targetBuffer}); // We have pushed an offset op if this was the case. - array = std::make_shared(datasetField->type(), offsetOp.rootBranchEntries, offsetOp.targetBuffer, varray); + array = std::make_shared(datasetField->type(), offsetOp.rootBranchEntries, offsetOp.targetBuffer, arrow::MakeArray(vdata)); O2_SIGNPOST_EVENT_EMIT(root_arrow_fs, tid, "Op", "Created op for branch %{public}s with %lli entries, size of the buffer %lli.", offsetOp.branch->GetName(), offsetOp.rootBranchEntries, offsetOp.targetBuffer->size()); O2_SIGNPOST_EVENT_EMIT(root_arrow_fs, tid, "Op", "Created op for branch %{public}s with %lli entries, size of the buffer %lli.", @@ -748,7 +751,9 @@ arrow::Result TTreeFileFormat::ScanBatchesAsync( offsetOp.offsetCount, valueOp.targetBuffer->size()); } else { - array = std::make_shared(datasetField->type(), valueOp.rootBranchEntries, valueOp.targetBuffer); + auto data = std::make_shared(datasetField->type(), valueOp.rootBranchEntries, + std::vector>{nullptr, valueOp.targetBuffer}); + array = arrow::MakeArray(data); O2_SIGNPOST_EVENT_EMIT(root_arrow_fs, tid, "Op", "Created op for branch %{public}s with %lli entries, size of the buffer %lli.", valueOp.branch->GetName(), valueOp.rootBranchEntries, diff --git a/Framework/Core/src/EmptyFragment.cxx b/Framework/Core/src/EmptyFragment.cxx index 588f605fb429e..0d72a72a51891 100644 --- a/Framework/Core/src/EmptyFragment.cxx +++ b/Framework/Core/src/EmptyFragment.cxx @@ -9,9 +9,13 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. #include "Framework/EmptyFragment.h" +#include #include #include #include +#include +#include +#include #include static constexpr int64_t kBufferMinimumSize = 256; @@ -35,8 +39,8 @@ arrow::Result EmptyFragment::ScanBatchesAsync( } else { size *= field->type()->field(0)->type()->byte_width(); } - auto varray = std::make_shared(field->type()->field(0)->type(), mRows * listType->list_size(), GetPlaceholderForOp(size)); - columns.push_back(std::make_shared(field->type(), (int32_t)mRows, varray)); + auto vdata = std::make_shared(field->type()->field(0)->type(), mRows * listType->list_size(), std::vector>{nullptr, GetPlaceholderForOp(size)}); + columns.push_back(std::make_shared(field->type(), (int32_t)mRows, arrow::MakeArray(vdata))); } else { size_t size = mRows; if (field->type()->byte_width() == 0) { @@ -44,7 +48,8 @@ arrow::Result EmptyFragment::ScanBatchesAsync( } else { size *= field->type()->byte_width(); } - columns.push_back(std::make_shared(field->type(), mRows, GetPlaceholderForOp(size))); + auto data = std::make_shared(field->type(), mRows, std::vector>{nullptr, GetPlaceholderForOp(size)}); + columns.push_back(arrow::MakeArray(data)); } } return arrow::RecordBatch::Make(physical_schema_, mRows, columns); diff --git a/Framework/Core/test/o2AO2DToAO3D.cxx b/Framework/Core/test/o2AO2DToAO3D.cxx index 1f54a71fc3296..6475081640df6 100644 --- a/Framework/Core/test/o2AO2DToAO3D.cxx +++ b/Framework/Core/test/o2AO2DToAO3D.cxx @@ -18,6 +18,7 @@ #include #include #include +#include int main(int argc, char** argv) {