30struct RSqliteDSDataSet;
75 std::vector<unsigned char>
fBlob;
82 std::unique_ptr<Internal::RSqliteDSDataSet>
fDataSet;
96 "std::vector<unsigned char>",
102 RSqliteDS(
const std::string &fileName,
const std::string &query);
104 void SetNSlots(
unsigned int nSlots)
final;
unsigned long long ULong64_t
RDataSource defines an API that RDataFrame can use to read arbitrary data formats.
std::vector< void * > Record_t
RSqliteDS is an RDF data source implementation for SQL result sets from sqlite3 files.
void SetNSlots(unsigned int nSlots) final
Almost a no-op, many slots can in fact reduce the performance due to thread synchronization.
static constexpr char const * fgTypeNames[]
Corresponds to the types defined in ETypes.
std::string GetLabel() final
Return a string representation of the datasource type.
void Initialise() final
Resets the SQlite query engine at the beginning of the event loop.
std::vector< std::string > fColumnNames
~RSqliteDS()
Frees the sqlite resources and closes the file.
bool HasColumn(std::string_view colName) const final
A linear search through the columns for the given name.
std::vector< ETypes > fColumnTypes
std::string GetTypeName(std::string_view colName) const final
Returns the C++ type for a given column name, implemented as a linear search through all the columns.
ETypes
All the types known to SQlite. Changes require changing fgTypeNames, too.
Record_t GetColumnReadersImpl(std::string_view name, const std::type_info &) final
Activates the given column's result value.
RSqliteDS(const std::string &fileName, const std::string &query)
Build the dataframe.
std::unique_ptr< Internal::RSqliteDSDataSet > fDataSet
std::vector< std::pair< ULong64_t, ULong64_t > > GetEntryRanges() final
Returns a range of size 1 as long as more rows are available in the SQL result set.
const std::vector< std::string > & GetColumnNames() const final
Returns the SELECT queries names.
bool SetEntry(unsigned int slot, ULong64_t entry) final
Stores the result of the current active sqlite query row as a C++ value.
void SqliteError(int errcode)
Helper function to throw an exception if there is a fatal sqlite error, e.g. an I/O error.
std::vector< Value_t > fValues
The data source is inherently single-threaded and returns only one row at a time. This vector holds t...
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...
RDataFrame MakeSqliteDataFrame(std::string_view fileName, std::string_view query)
Factory method to create a SQlite RDataFrame.
Used to hold a single "cell" of the SELECT query's result table. Can be changed to std::variant once ...
void * fPtr
Points to one of the values; an address to this pointer is returned by GetColumnReadersImpl.
std::vector< unsigned char > fBlob
bool fIsActive
Not all columns of the query are necessarily used by the RDF. Allows for skipping them.