Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::QueryAppender Class Reference
Inheritance diagram for duckdb::QueryAppender:
Collaboration diagram for duckdb::QueryAppender:

Public Member Functions

DUCKDB_API QueryAppender (Connection &con, string query, vector< LogicalType > types, vector< string > names=vector< string >(), string table_name=string(), const idx_t flush_memory_threshold=DConstants::INVALID_INDEX)
Public Member Functions inherited from duckdb::BaseAppender
DUCKDB_API void BeginRow ()
 Begins a new row append, after calling this the other AppendX() functions should be called the correct amount of times. After that, EndRow() should be called.
DUCKDB_API void EndRow ()
 Finishes appending the current row.
template<class T>
void Append (T value)=delete
DUCKDB_API void Append (DataChunk &target, const Value &value, idx_t col, idx_t row)
DUCKDB_API void Append (const char *value, uint32_t length)
template<typename... ARGS>
void AppendRow (ARGS... args)
DUCKDB_API void Flush ()
 Commit the changes made by the appender.
DUCKDB_API void Close ()
 Flush the changes made by the appender and close it. The appender cannot be used after this point.
DUCKDB_API void Clear ()
 Clears any appended data (without flushing).
const vector< LogicalType > & GetActiveTypes () const
 Returns the active types of the appender.
idx_t CurrentColumn () const
DUCKDB_API void AppendDataChunk (DataChunk &value)
virtual void AppendDefault ()
virtual void AppendDefault (DataChunk &chunk, idx_t col, idx_t row)
virtual void AddColumn (const string &name)
 Appends a column to the active column list. Immediately flushes all previous data.
virtual void ClearColumns ()
 Removes all columns from the active column list. Immediately flushes all previous data.
template<>
void Append (bool value)
template<>
void Append (int8_t value)
template<>
void Append (int16_t value)
template<>
void Append (int32_t value)
template<>
void Append (int64_t value)
template<>
void Append (hugeint_t value)
template<>
void Append (uhugeint_t value)
template<>
void Append (uint8_t value)
template<>
void Append (uint16_t value)
template<>
void Append (uint32_t value)
template<>
void Append (uint64_t value)
template<>
void Append (const char *value)
template<>
void Append (string_t value)
template<>
void Append (float value)
template<>
void Append (double value)
template<>
void Append (date_t value)
template<>
void Append (dtime_t value)
template<>
void Append (timestamp_t value)
template<>
void Append (interval_t value)
template<>
void Append (Value value)
template<>
void Append (std::nullptr_t value)
template<>
DUCKDB_API void Append (bool value)
template<>
DUCKDB_API void Append (int8_t value)
template<>
DUCKDB_API void Append (int16_t value)
template<>
DUCKDB_API void Append (int32_t value)
template<>
DUCKDB_API void Append (int64_t value)
template<>
DUCKDB_API void Append (hugeint_t value)
template<>
DUCKDB_API void Append (uhugeint_t value)
template<>
DUCKDB_API void Append (uint8_t value)
template<>
DUCKDB_API void Append (uint16_t value)
template<>
DUCKDB_API void Append (uint32_t value)
template<>
DUCKDB_API void Append (uint64_t value)
template<>
DUCKDB_API void Append (float value)
template<>
DUCKDB_API void Append (double value)
template<>
DUCKDB_API void Append (date_t value)
template<>
DUCKDB_API void Append (dtime_t value)
template<>
DUCKDB_API void Append (timestamp_t value)
template<>
DUCKDB_API void Append (interval_t value)
template<>
DUCKDB_API void Append (const char *value)
template<>
DUCKDB_API void Append (string_t value)
template<>
DUCKDB_API void Append (Value value)
template<>
DUCKDB_API void Append (std::nullptr_t value)

Protected Member Functions

void FlushInternal (ColumnDataCollection &collection) override
Protected Member Functions inherited from duckdb::BaseAppender
DUCKDB_API BaseAppender (Allocator &allocator, const AppenderType type)
DUCKDB_API BaseAppender (Allocator &allocator, vector< LogicalType > types, const AppenderType type, const idx_t flush_count=DEFAULT_FLUSH_COUNT)
void Destructor ()
void InitializeChunk ()
void FlushChunk ()
bool ShouldFlushChunk () const
bool ShouldFlush () const
template<class T>
void AppendValueInternal (T value)
template<class SRC, class DST>
void AppendValueInternal (Vector &vector, SRC input)
template<class SRC, class DST>
void AppendDecimalValueInternal (Vector &vector, SRC input)
void AppendRowRecursive ()
template<typename T, typename... ARGS>
void AppendRowRecursive (T value, ARGS... args)
void AppendValue (const Value &value)
void AppendValue (DataChunk target, const Value &value)

Private Attributes

weak_ptr< ClientContext > context
 A shared pointer to the context of this appender.
string query
 The query to run.
vector< string > names
 The column names of the to-be-appended data, or "col1, col2, ...", if empty.
string table_name
 The table name that we can reference in the query, or "appended_data", if empty.

Additional Inherited Members

Static Public Member Functions inherited from duckdb::BaseAppender
static unique_ptr< TableRef > GetColumnDataTableRef (ColumnDataCollection &collection, const string &table_name, const vector< string > &expected_names)
 Returns a table reference to the appended data.
static unique_ptr< SQLStatement > ParseStatement (unique_ptr< TableRef > table_ref, const string &query, const string &table_name)
 Parses the statement to append data.
Static Public Attributes inherited from duckdb::BaseAppender
static constexpr const idx_t DEFAULT_FLUSH_COUNT = STANDARD_VECTOR_SIZE * 100ULL
 The amount of tuples that are gathered in the column data collection before flushing.
Protected Attributes inherited from duckdb::BaseAppender
Allocator & allocator
 The allocator for the column data collection.
vector< LogicalType > types
 The column types of the associated table.
vector< LogicalType > active_types
 The active column types.
unique_ptr< ColumnDataCollection > collection
 The buffered to-be-appended data.
DataChunk chunk
 The active chunk for row-based appends.
idx_t column = 0
 The currently active column of row-based appends.
AppenderType appender_type
 The type of the appender.
idx_t flush_count = DEFAULT_FLUSH_COUNT
 The amount of rows after which the appender flushes automatically.
optional_idx flush_memory_threshold
 Peak allocation threshold at which to flush the allocator when appender flushs chunk.

Constructor & Destructor Documentation

◆ QueryAppender()

duckdb::QueryAppender::QueryAppender ( Connection & con,
string query,
vector< LogicalType > types,
vector< string > names = vector<string>(),
string table_name = string(),
const idx_t flush_memory_threshold = DConstants::INVALID_INDEX )
261976 : BaseAppender(Allocator::DefaultAllocator(), AppenderType::LOGICAL), context(con.context),
261977 query(std::move(query_p)), names(std::move(names_p)), table_name(std::move(table_name_p)) {
261978 types = std::move(types_p);
261979 InitializeChunk();
261980 collection = make_uniq<ColumnDataCollection>(allocator, GetActiveTypes());
261981 flush_memory_threshold = (flush_memory_threshold_p == DConstants::INVALID_INDEX)
261982 ? optional_idx::Invalid()
261983 : optional_idx(flush_memory_threshold_p);
261984}
const vector< LogicalType > & GetActiveTypes() const
Returns the active types of the appender.
Definition duckdb.cpp:261335
Allocator & allocator
The allocator for the column data collection.
Definition duckdb.hpp:54335
vector< LogicalType > types
The column types of the associated table.
Definition duckdb.hpp:54337
optional_idx flush_memory_threshold
Peak allocation threshold at which to flush the allocator when appender flushs chunk.
Definition duckdb.hpp:54351
unique_ptr< ColumnDataCollection > collection
The buffered to-be-appended data.
Definition duckdb.hpp:54341
string table_name
The table name that we can reference in the query, or "appended_data", if empty.
Definition duckdb.hpp:54488
vector< string > names
The column names of the to-be-appended data, or "col1, col2, ...", if empty.
Definition duckdb.hpp:54486
weak_ptr< ClientContext > context
A shared pointer to the context of this appender.
Definition duckdb.hpp:54482
string query
The query to run.
Definition duckdb.hpp:54484
static constexpr const idx_t INVALID_INDEX
The value used to signify an invalid index entry.
Definition duckdb.hpp:1117

◆ ~QueryAppender()

duckdb::QueryAppender::~QueryAppender ( )
override
261986 {
261987}

Member Function Documentation

◆ FlushInternal()

void duckdb::QueryAppender::FlushInternal ( ColumnDataCollection & collection)
overrideprotectedvirtual

Implements duckdb::BaseAppender.

261989 {
261990 auto context_ref = context.lock();
261991 if (!context_ref) {
261992 throw InvalidInputException("Attempting to flush query appender data on a closed connection");
261993 }
261994 auto table_ref = GetColumnDataTableRef(collection, table_name, names);
261995 auto parsed_statement = ParseStatement(std::move(table_ref), query, table_name);
261996 context_ref->Append(std::move(parsed_statement));
261997}
static unique_ptr< TableRef > GetColumnDataTableRef(ColumnDataCollection &collection, const string &table_name, const vector< string > &expected_names)
Returns a table reference to the appended data.
Definition duckdb.cpp:261713
static unique_ptr< SQLStatement > ParseStatement(unique_ptr< TableRef > table_ref, const string &query, const string &table_name)
Parses the statement to append data.
Definition duckdb.cpp:261738

The documentation for this class was generated from the following files: