Project
Loading...
Searching...
No Matches
ArrowTable.h
Go to the documentation of this file.
1// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef O2_FRAMEWORK_AODNATIVE_ARROWTABLE_H_
13#define O2_FRAMEWORK_AODNATIVE_ARROWTABLE_H_
14
15#include "AODNative/Decoder.h"
16#include "AODNative/Objects.h"
17#include <arrow/memory_pool.h>
18#include <arrow/record_batch.h>
19#include <arrow/result.h>
20#include <arrow/type.h>
21#include <memory>
22#include <vector>
23
25{
26
30std::shared_ptr<arrow::Schema> physicalSchema(TreeInfo const& tree);
31
33std::shared_ptr<arrow::Schema> datasetSchema(std::shared_ptr<arrow::Schema> const& physical);
34
37struct ColumnOp {
38 enum struct Kind { Values,
40 VLA };
44 size_t byteSize;
46 std::shared_ptr<arrow::Buffer> offsets;
47};
48
52std::vector<ColumnOp> planColumns(TreeInfo const& tree, std::shared_ptr<arrow::Schema> const& schema,
53 BranchDecoder& decoder, arrow::MemoryPool* pool, int64_t& rows);
54
56void executeColumnOp(BranchDecoder& decoder, ColumnOp const& op, uint8_t* dst);
57
59std::shared_ptr<arrow::RecordBatch> makeBatch(std::shared_ptr<arrow::Schema> const& schema, std::vector<ColumnOp> const& ops,
60 std::vector<std::shared_ptr<arrow::Buffer>> const& buffers, int64_t rows);
61
63arrow::Result<std::shared_ptr<arrow::RecordBatch>> readTree(ByteSource& source, TreeInfo const& tree, Options const& options,
64 arrow::MemoryPool* pool = arrow::default_memory_pool());
65
66} // namespace o2::aod::native
67
68#endif // O2_FRAMEWORK_AODNATIVE_ARROWTABLE_H_
std::shared_ptr< arrow::Schema > schema
uint32_t op
GLsizei GLsizei GLchar * source
Definition glcorearb.h:798
GLenum GLenum dst
Definition glcorearb.h:1767
const GLuint * buffers
Definition glcorearb.h:656
std::shared_ptr< arrow::Schema > datasetSchema(std::shared_ptr< arrow::Schema > const &physical)
The physical schema without the *_size fields, as DataInputDirector derives it.
std::shared_ptr< arrow::RecordBatch > makeBatch(std::shared_ptr< arrow::Schema > const &schema, std::vector< ColumnOp > const &ops, std::vector< std::shared_ptr< arrow::Buffer > > const &buffers, int64_t rows)
Wraps the buffers of ops (one per op, in order) into a record batch.
arrow::Result< std::shared_ptr< arrow::RecordBatch > > readTree(ByteSource &source, TreeInfo const &tree, Options const &options, arrow::MemoryPool *pool=arrow::default_memory_pool())
Reads a whole tree into heap memory: plan, execute, wrap.
std::shared_ptr< arrow::Schema > physicalSchema(TreeInfo const &tree)
std::vector< ColumnOp > planColumns(TreeInfo const &tree, std::shared_ptr< arrow::Schema > const &schema, BranchDecoder &decoder, arrow::MemoryPool *pool, int64_t &rows)
void executeColumnOp(BranchDecoder &decoder, ColumnOp const &op, uint8_t *dst)
Fills the buffer of op, which is exactly op.byteSize bytes.
BranchInfo const * branch
Definition ArrowTable.h:42
std::shared_ptr< arrow::Buffer > offsets
For VLA columns: the offsets, decoded eagerly because they size the values.
Definition ArrowTable.h:46
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))
std::vector< ReadoutWindowData > rows