Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:22:25

0001 /*************************************************************************
0002  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers.               *
0003  * All rights reserved.                                                  *
0004  *                                                                       *
0005  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0006  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
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 } // namespace RDF
0026 } // namespace Internal
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; // (columnId, visitorId)
0038    std::vector<std::unique_ptr<ROOT::Internal::RDF::TValueGetter>> fValueGetters; // Visitors to be used to track and get entries. One per column.
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 } // namespace RDF
0058 
0059 } // namespace ROOT
0060 
0061 #endif