Logo ROOT   6.14/05
Reference Guide
RArrowDS.hxx
Go to the documentation of this file.
1 #ifndef ROOT_RARROWTDS
2 #define ROOT_RARROWTDS
3 
4 #include "ROOT/RDataFrame.hxx"
5 #include "ROOT/RDataSource.hxx"
6 
7 #include <memory>
8 
9 namespace arrow {
10 class Table;
11 }
12 
13 namespace ROOT {
14 namespace Internal {
15 namespace RDF {
16 class TValueGetter;
17 } // namespace RDF
18 } // namespace Internal
19 
20 
21 namespace RDF {
22 
23 class RArrowDS final : public RDataSource {
24 private:
25  std::shared_ptr<arrow::Table> fTable;
26  std::vector<std::pair<ULong64_t, ULong64_t>> fEntryRanges;
27  std::vector<std::string> fColumnNames;
28  size_t fNSlots = 0U;
29 
30  std::vector<std::pair<size_t, size_t>> fGetterIndex; // (columnId, visitorId)
31  std::vector<std::unique_ptr<ROOT::Internal::RDF::TValueGetter>> fValueGetters; // Visitors to be used to track and get entries. One per column.
32  std::vector<void *> GetColumnReadersImpl(std::string_view name, const std::type_info &type) override;
33 
34 public:
35  RArrowDS(std::shared_ptr<arrow::Table> table, std::vector<std::string> const &columns);
36  ~RArrowDS();
37  const std::vector<std::string> &GetColumnNames() const override;
38  std::vector<std::pair<ULong64_t, ULong64_t>> GetEntryRanges() override;
39  std::string GetTypeName(std::string_view colName) const override;
40  bool HasColumn(std::string_view colName) const override;
41  bool SetEntry(unsigned int slot, ULong64_t entry) override;
42  void InitSlot(unsigned int slot, ULong64_t firstEntry) override;
43  void SetNSlots(unsigned int nSlots) override;
44  void Initialise() override;
45 };
46 
47 ////////////////////////////////////////////////////////////////////////////////////////////////
48 /// \brief Factory method to create a Apache Arrow RDataFrame.
49 /// \param[in] table an apache::arrow table to use as a source.
50 RDataFrame MakeArrowDataFrame(std::shared_ptr<arrow::Table> table, std::vector<std::string> const &columns);
51 
52 } // namespace RDF
53 
54 } // namespace ROOT
55 
56 #endif
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
RDataFrame data source class to interface with Apache Arrow.
Definition: RArrowDS.hxx:23
RDataFrame MakeArrowDataFrame(std::shared_ptr< arrow::Table > table, std::vector< std::string > const &columns)
Factory method to create a Apache Arrow RDataFrame.
Definition: RArrowDS.cxx:500
std::vector< std::pair< ULong64_t, ULong64_t > > fEntryRanges
Definition: RArrowDS.hxx:26
std::vector< std::unique_ptr< ROOT::Internal::RDF::TValueGetter > > fValueGetters
Definition: RArrowDS.hxx:31
ROOT&#39;s RDataFrame offers a high level interface for analyses of data stored in TTrees, CSV&#39;s and other data formats.
Definition: RDataFrame.hxx:42
int type
Definition: TGX11.cxx:120
unsigned long long ULong64_t
Definition: RtypesCore.h:70
basic_string_view< char > string_view
Definition: RStringView.hxx:35
std::shared_ptr< arrow::Table > fTable
Definition: RArrowDS.hxx:25
RDataSource defines an API that RDataFrame can use to read arbitrary data formats.
Definition: RDataSource.hxx:91
char name[80]
Definition: TGX11.cxx:109
std::vector< std::string > fColumnNames
Definition: RArrowDS.hxx:27
std::vector< std::pair< size_t, size_t > > fGetterIndex
Definition: RArrowDS.hxx:30