File indexing completed on 2025-01-30 10:22:25
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef ROOT_RARROWTDS
0010 #define ROOT_RARROWTDS
0011
0012 #include "ROOT/RDataFrame.hxx"
0013 #include "ROOT/RDataSource.hxx"
0014
0015 #include <memory>
0016
0017 namespace arrow {
0018 class Table;
0019 }
0020
0021 namespace ROOT {
0022 namespace Internal {
0023 namespace RDF {
0024 class TValueGetter;
0025 }
0026 }
0027
0028 namespace RDF {
0029
0030 class RArrowDS final : public RDataSource {
0031 private:
0032 std::shared_ptr<arrow::Table> fTable;
0033 std::vector<std::pair<ULong64_t, ULong64_t>> fEntryRanges;
0034 std::vector<std::string> fColumnNames;
0035 size_t fNSlots = 0U;
0036
0037 std::vector<std::pair<size_t, size_t>> fGetterIndex;
0038 std::vector<std::unique_ptr<ROOT::Internal::RDF::TValueGetter>> fValueGetters;
0039 std::vector<void *> GetColumnReadersImpl(std::string_view name, const std::type_info &type) final;
0040
0041 public:
0042 RArrowDS(std::shared_ptr<arrow::Table> table, std::vector<std::string> const &columns);
0043 ~RArrowDS();
0044 const std::vector<std::string> &GetColumnNames() const final;
0045 std::vector<std::pair<ULong64_t, ULong64_t>> GetEntryRanges() final;
0046 std::string GetTypeName(std::string_view colName) const final;
0047 bool HasColumn(std::string_view colName) const final;
0048 bool SetEntry(unsigned int slot, ULong64_t entry) final;
0049 void InitSlot(unsigned int slot, ULong64_t firstEntry) final;
0050 void SetNSlots(unsigned int nSlots) final;
0051 void Initialize() final;
0052 std::string GetLabel() final;
0053 };
0054
0055 RDataFrame FromArrow(std::shared_ptr<arrow::Table> table, std::vector<std::string> const &columnNames);
0056
0057 }
0058
0059 }
0060
0061 #endif