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
BaseAppender Class Referenceabstract

The Appender class can be used to append elements to a table. More...

#include <duckdb.hpp>

Inheritance diagram for BaseAppender:
Collaboration diagram for BaseAppender:

Public Member Functions

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<>
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)
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.

Static Public Member Functions

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

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 Member Functions

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 ()
virtual void FlushInternal (ColumnDataCollection &collection)=0
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)

Protected Attributes

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.

Detailed Description

The Appender class can be used to append elements to a table.

Constructor & Destructor Documentation

◆ BaseAppender() [1/2]

duckdb::BaseAppender::BaseAppender ( Allocator & allocator,
const AppenderType type )
protected
261309 : allocator(allocator), column(0), appender_type(type_p) {
261310}
Allocator & allocator
The allocator for the column data collection.
Definition duckdb.hpp:54335
idx_t column
The currently active column of row-based appends.
Definition duckdb.hpp:54345
Allocator & allocator
The allocator for the column data collection.
Definition duckdb.hpp:54335
AppenderType appender_type
The type of the appender.
Definition duckdb.hpp:54347

◆ BaseAppender() [2/2]

duckdb::BaseAppender::BaseAppender ( Allocator & allocator,
vector< LogicalType > types,
const AppenderType type,
const idx_t flush_count = DEFAULT_FLUSH_COUNT )
protected
261314 : allocator(allocator_p), types(std::move(types_p)), collection(make_uniq<ColumnDataCollection>(allocator, types)),
261315 column(0), appender_type(type_p), flush_count(flush_count_p) {
261316 InitializeChunk();
261317}
vector< LogicalType > types
The column types of the associated table.
Definition duckdb.hpp:54337
idx_t flush_count
The amount of rows after which the appender flushes automatically.
Definition duckdb.hpp:54349
vector< LogicalType > types
The column types of the associated table.
Definition duckdb.hpp:54337
unique_ptr< ColumnDataCollection > collection
The buffered to-be-appended data.
Definition duckdb.hpp:54341

◆ ~BaseAppender()

duckdb::BaseAppender::~BaseAppender ( )
virtual
261319 {
261320}

Member Function Documentation

◆ GetColumnDataTableRef()

unique_ptr< TableRef > duckdb::BaseAppender::GetColumnDataTableRef ( ColumnDataCollection & collection,
const string & table_name,
const vector< string > & expected_names )
static

Returns a table reference to the appended data.

261714 {
261715 auto column_data_ref = make_uniq<ColumnDataRef>(collection);
261716 column_data_ref->alias = table_name.empty() ? "appended_data" : table_name;
261717 ;
261718 column_data_ref->expected_names = expected_names;
261719 return std::move(column_data_ref);
261720}
unique_ptr< ColumnDataCollection > collection
The buffered to-be-appended data.
Definition duckdb.hpp:54341

◆ ParseStatement()

unique_ptr< SQLStatement > duckdb::BaseAppender::ParseStatement ( unique_ptr< TableRef > table_ref,
const string & query,
const string & table_name )
static

Parses the statement to append data.

261739 {
261740 // Parse the query.
261741 Parser parser;
261742 parser.ParseQuery(query);
261743
261744 // Must be a single statement.
261745 if (parser.statements.size() != 1) {
261746 throw InvalidInputException("Expected exactly one query for appending data.");
261747 }
261748
261749 // Create the CTE for the appender.
261750 auto cte = make_uniq<SelectNode>();
261751 cte->select_list.push_back(make_uniq<StarExpression>());
261752 cte->from_table = std::move(table_ref);
261753
261754 // Create the SELECT CTE.
261755 auto cte_select = make_uniq<SelectStatement>();
261756 cte_select->node = std::move(cte);
261757
261758 // Create the CTE info.
261759 auto cte_info = make_uniq<CommonTableExpressionInfo>();
261760 cte_info->query = std::move(cte_select);
261761 cte_info->materialized = CTEMaterialize::CTE_MATERIALIZE_NEVER;
261762
261763 // Add the appender data as a CTE to the CTE map of the statement.
261764 string alias = table_name.empty() ? "appended_data" : table_name;
261765 auto &cte_map = GetCTEMap(*parser.statements[0]);
261766 cte_map.map.insert(alias, std::move(cte_info));
261767
261768 return std::move(parser.statements[0]);
261769}

◆ 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.

261347 {
261348}

◆ EndRow()

Finishes appending the current row.

261350 {
261351 // Ensure that all columns have been appended to.
261352 if (column != chunk.ColumnCount()) {
261353 throw InvalidInputException("Call to EndRow before all columns have been appended to!");
261354 }
261355 column = 0;
261356 chunk.SetCardinality(chunk.size() + 1);
261357 if (ShouldFlushChunk()) {
261358 FlushChunk();
261359 }
261360}
idx_t column
The currently active column of row-based appends.
Definition duckdb.hpp:54345
DataChunk chunk
The active chunk for row-based appends.
Definition duckdb.hpp:54343

◆ Append() [1/23]

void duckdb::BaseAppender::Append ( DataChunk & target,
const Value & value,
idx_t col,
idx_t row )
261589 {
261590 if (col >= target.ColumnCount()) {
261591 throw InvalidInputException("Too many appends for chunk!");
261592 }
261593 if (row >= target.GetCapacity()) {
261594 throw InvalidInputException("Too many rows for chunk!");
261595 }
261596
261597 if (value.type() == target.GetTypes()[col]) {
261598 target.SetValue(col, row, value);
261599 } else {
261600 Value new_value;
261601 string error_msg;
261602 if (value.DefaultTryCastAs(target.GetTypes()[col], new_value, &error_msg)) {
261603 target.SetValue(col, row, new_value);
261604 } else {
261605 throw InvalidInputException("type mismatch in Append, expected %s, got %s for column %d",
261606 target.GetTypes()[col], value.type(), col);
261607 }
261608 }
261609}
DUCKDB_API vector< LogicalType > GetTypes() const
Returns a list of types of the vectors of this data chunk.
Definition duckdb.cpp:116995

◆ Append() [2/23]

void duckdb::BaseAppender::Append ( const char * value,
uint32_t length )
261542 {
261543 AppendValueInternal<string_t>(string_t(value, length));
261544}

◆ Append() [3/23]

template<>
void duckdb::BaseAppender::Append ( bool value)
261483 {
261484 AppendValueInternal<bool>(value);
261485}

◆ Append() [4/23]

template<>
void duckdb::BaseAppender::Append ( int8_t value)
261488 {
261489 AppendValueInternal<int8_t>(value);
261490}

◆ Append() [5/23]

template<>
void duckdb::BaseAppender::Append ( int16_t value)
261493 {
261494 AppendValueInternal<int16_t>(value);
261495}

◆ Append() [6/23]

template<>
void duckdb::BaseAppender::Append ( int32_t value)
261498 {
261499 AppendValueInternal<int32_t>(value);
261500}

◆ Append() [7/23]

template<>
void duckdb::BaseAppender::Append ( int64_t value)
261503 {
261504 AppendValueInternal<int64_t>(value);
261505}

◆ Append() [8/23]

template<>
void duckdb::BaseAppender::Append ( hugeint_t value)
261508 {
261509 AppendValueInternal<hugeint_t>(value);
261510}

◆ Append() [9/23]

template<>
void duckdb::BaseAppender::Append ( uhugeint_t value)
261513 {
261514 AppendValueInternal<uhugeint_t>(value);
261515}

◆ Append() [10/23]

template<>
void duckdb::BaseAppender::Append ( uint8_t value)
261518 {
261519 AppendValueInternal<uint8_t>(value);
261520}

◆ Append() [11/23]

template<>
void duckdb::BaseAppender::Append ( uint16_t value)
261523 {
261524 AppendValueInternal<uint16_t>(value);
261525}

◆ Append() [12/23]

template<>
void duckdb::BaseAppender::Append ( uint32_t value)
261528 {
261529 AppendValueInternal<uint32_t>(value);
261530}

◆ Append() [13/23]

template<>
void duckdb::BaseAppender::Append ( uint64_t value)
261533 {
261534 AppendValueInternal<uint64_t>(value);
261535}

◆ Append() [14/23]

template<>
void duckdb::BaseAppender::Append ( const char * value)
261538 {
261539 AppendValueInternal<string_t>(string_t(value));
261540}

◆ Append() [15/23]

template<>
void duckdb::BaseAppender::Append ( string_t value)
261547 {
261548 AppendValueInternal<string_t>(value);
261549}

◆ Append() [16/23]

template<>
void duckdb::BaseAppender::Append ( float value)
261552 {
261553 AppendValueInternal<float>(value);
261554}

◆ Append() [17/23]

template<>
void duckdb::BaseAppender::Append ( double value)
261557 {
261558 AppendValueInternal<double>(value);
261559}

◆ Append() [18/23]

template<>
void duckdb::BaseAppender::Append ( date_t value)
261562 {
261563 AppendValueInternal<date_t>(value);
261564}

◆ Append() [19/23]

template<>
void duckdb::BaseAppender::Append ( dtime_t value)
261567 {
261568 AppendValueInternal<dtime_t>(value);
261569}

◆ Append() [20/23]

template<>
void duckdb::BaseAppender::Append ( timestamp_t value)
261572 {
261573 AppendValueInternal<timestamp_t>(value);
261574}

◆ Append() [21/23]

template<>
void duckdb::BaseAppender::Append ( interval_t value)
261577 {
261578 AppendValueInternal<interval_t>(value);
261579}

◆ Append() [22/23]

template<>
void duckdb::BaseAppender::Append ( Value value)
261582 { // NOLINT: template stuff
261583 if (column >= chunk.ColumnCount()) {
261584 throw InvalidInputException("Too many appends for chunk!");
261585 }
261586 AppendValue(value);
261587}

◆ Append() [23/23]

template<>
void duckdb::BaseAppender::Append ( std::nullptr_t value)
261612 {
261613 if (column >= chunk.ColumnCount()) {
261614 throw InvalidInputException("Too many appends for chunk!");
261615 }
261616 auto &col = chunk.data[column++];
261617 FlatVector::SetNull(col, chunk.size(), true);
261618}

◆ AppendRow()

template<typename... ARGS>
void duckdb::BaseAppender::AppendRow ( ARGS... args)
inline
54377 {
54378 BeginRow();
54379 AppendRowRecursive(args...);
54380 }
DUCKDB_API void BeginRow()
Begins a new row append, after calling this the other AppendX() functions should be called the correc...
Definition duckdb.cpp:261347

◆ Flush()

Commit the changes made by the appender.

261681 {
261682 // Check that all vectors have the same length before appending.
261683 if (column != 0) {
261684 throw InvalidInputException("Failed to Flush appender: incomplete append to row!");
261685 }
261686
261687 FlushChunk();
261688 if (collection->Count() == 0) {
261689 return;
261690 }
261691
261692 FlushInternal(*collection);
261693 collection->Reset();
261694 column = 0;
261695}

◆ Close()

Flush the changes made by the appender and close it. The appender cannot be used after this point.

262021 {
262022 if (column == 0 || column == GetActiveTypes().size()) {
262023 Flush();
262024 }
262025}
const vector< LogicalType > & GetActiveTypes() const
Returns the active types of the appender.
Definition duckdb.cpp:261335
DUCKDB_API void Flush()
Commit the changes made by the appender.
Definition duckdb.cpp:261681
GOpaque< Size > size(const GMat &src)

◆ Clear()

Clears any appended data (without flushing).

262027 {
262028 chunk.Reset();
262029
262030 if (collection) {
262031 collection->Reset();
262032 }
262033
262034 column = 0;
262035}

◆ GetActiveTypes()

Returns the active types of the appender.

261335 {
261336 if (active_types.empty()) {
261337 return types;
261338 }
261339 return active_types;
261340}
vector< LogicalType > active_types
The active column types.
Definition duckdb.hpp:54339

◆ CurrentColumn()

idx_t duckdb::BaseAppender::CurrentColumn ( ) const
inline
54391 {
54392 return column;
54393 }

◆ AppendDataChunk()

void duckdb::BaseAppender::AppendDataChunk ( DataChunk & value)
261625 {
261626 auto chunk_types = chunk_p.GetTypes();
261627 auto &appender_types = GetActiveTypes();
261628
261629 // Early-out, if types match.
261630 if (chunk_types == appender_types) {
261631 collection->Append(chunk_p);
261632 if (ShouldFlush()) {
261633 Flush();
261634 }
261635 return;
261636 }
261637
261638 auto count = chunk_p.ColumnCount();
261639 if (count != appender_types.size()) {
261640 throw InvalidInputException("incorrect column count in AppendDataChunk, expected %d, got %d",
261641 appender_types.size(), count);
261642 }
261643
261644 // We try to cast the chunk.
261645 auto size = chunk_p.size();
261646 DataChunk cast_chunk;
261647 cast_chunk.Initialize(allocator, appender_types);
261648 cast_chunk.SetCardinality(size);
261649
261650 for (idx_t i = 0; i < count; i++) {
261651 if (chunk_p.data[i].GetType() == appender_types[i]) {
261652 cast_chunk.data[i].Reference(chunk_p.data[i]);
261653 continue;
261654 }
261655
261656 string error_msg;
261657 auto success = VectorOperations::DefaultTryCast(chunk_p.data[i], cast_chunk.data[i], size, &error_msg);
261658 if (!success) {
261659 throw InvalidInputException("type mismatch in AppendDataChunk, expected %s, got %s for column %d",
261660 appender_types[i].ToString(), chunk_p.data[i].GetType().ToString(), i);
261661 }
261662 }
261663
261664 collection->Append(cast_chunk);
261665 if (ShouldFlush()) {
261666 Flush();
261667 }
261668}
DUCKDB_API void Initialize(ClientContext &context, const vector< LogicalType > &types, idx_t capacity=STANDARD_VECTOR_SIZE)
Definition duckdb.cpp:116791
vector< Vector > data
The vectors owned by the DataChunk.
Definition duckdb.hpp:11445
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ AppendDefault() [1/2]

void duckdb::BaseAppender::AppendDefault ( )
virtual
261697 {
261698 throw NotImplementedException("AppendDefault is only supported when directly appending to a table");
261699}

◆ AppendDefault() [2/2]

void duckdb::BaseAppender::AppendDefault ( DataChunk & chunk,
idx_t col,
idx_t row )
virtual
261701 {
261702 throw NotImplementedException("AppendDefault is only supported when directly appending to a table");
261703}

◆ AddColumn()

void duckdb::BaseAppender::AddColumn ( const string & name)
virtual

Appends a column to the active column list. Immediately flushes all previous data.

261705 {
261706 throw NotImplementedException("AddColumn is only supported when directly appending to a table");
261707}

◆ ClearColumns()

Removes all columns from the active column list. Immediately flushes all previous data.

261709 {
261710 throw NotImplementedException("ClearColumns is only supported when directly appending to a table");
261711}

◆ Destructor()

void duckdb::BaseAppender::Destructor ( )
protected
261322 {
261323 if (Exception::UncaughtException()) {
261324 return;
261325 }
261326 // Flush any remaining chunks, if we are not cleaning up as part of an exception stack unwind wrapped in a
261327 // try/catch. Close() can throw if the table was dropped in the meantime.
261328 try {
261329 Close();
261330 } catch (...) { // NOLINT
261331 // FIXME: Make any log context available here.
261332 }
261333}
DUCKDB_API void Close()
Flush the changes made by the appender and close it. The appender cannot be used after this point.
Definition duckdb.cpp:262021

◆ InitializeChunk()

void duckdb::BaseAppender::InitializeChunk ( )
protected
261342 {
261343 chunk.Destroy();
261344 chunk.Initialize(allocator, GetActiveTypes());
261345}

◆ FlushChunk()

void duckdb::BaseAppender::FlushChunk ( )
protected
261670 {
261671 if (chunk.size() == 0) {
261672 return;
261673 }
261674 collection->Append(chunk);
261675 chunk.Reset();
261676 if (ShouldFlush()) {
261677 Flush();
261678 }
261679}

◆ ShouldFlushChunk()

bool duckdb::BaseAppender::ShouldFlushChunk ( ) const
protected
262037 {
262038 if (chunk.size() >= STANDARD_VECTOR_SIZE) {
262039 return true;
262040 }
262041
262042 if (!flush_memory_threshold.IsValid()) {
262043 return false;
262044 }
262045
262046 return (collection->AllocationSize() >= flush_memory_threshold.GetIndex());
262047}
optional_idx flush_memory_threshold
Peak allocation threshold at which to flush the allocator when appender flushs chunk.
Definition duckdb.hpp:54351

◆ ShouldFlush()

bool duckdb::BaseAppender::ShouldFlush ( ) const
protected
262049 {
262050 if (collection->Count() >= flush_count) {
262051 return true;
262052 }
262053
262054 if (!flush_memory_threshold.IsValid()) {
262055 return false;
262056 }
262057
262058 return (collection->AllocationSize() >= flush_memory_threshold.GetIndex());
262059}
idx_t flush_count
The amount of rows after which the appender flushes automatically.
Definition duckdb.hpp:54349

◆ AppendValueInternal() [1/2]

template<class T>
void duckdb::BaseAppender::AppendValueInternal ( T value)
protected
261390 {
261391 if (column >= GetActiveTypes().size()) {
261392 throw InvalidInputException("Too many appends for chunk!");
261393 }
261394 auto &col = chunk.data[column];
261395 switch (col.GetType().id()) {
261396 case LogicalTypeId::BOOLEAN:
261397 AppendValueInternal<T, bool>(col, input);
261398 break;
261399 case LogicalTypeId::UTINYINT:
261400 AppendValueInternal<T, uint8_t>(col, input);
261401 break;
261402 case LogicalTypeId::TINYINT:
261403 AppendValueInternal<T, int8_t>(col, input);
261404 break;
261405 case LogicalTypeId::USMALLINT:
261406 AppendValueInternal<T, uint16_t>(col, input);
261407 break;
261408 case LogicalTypeId::SMALLINT:
261409 AppendValueInternal<T, int16_t>(col, input);
261410 break;
261411 case LogicalTypeId::UINTEGER:
261412 AppendValueInternal<T, uint32_t>(col, input);
261413 break;
261414 case LogicalTypeId::INTEGER:
261415 AppendValueInternal<T, int32_t>(col, input);
261416 break;
261417 case LogicalTypeId::UBIGINT:
261418 AppendValueInternal<T, uint64_t>(col, input);
261419 break;
261420 case LogicalTypeId::BIGINT:
261421 AppendValueInternal<T, int64_t>(col, input);
261422 break;
261423 case LogicalTypeId::HUGEINT:
261424 AppendValueInternal<T, hugeint_t>(col, input);
261425 break;
261426 case LogicalTypeId::UHUGEINT:
261427 AppendValueInternal<T, uhugeint_t>(col, input);
261428 break;
261429 case LogicalTypeId::FLOAT:
261430 AppendValueInternal<T, float>(col, input);
261431 break;
261432 case LogicalTypeId::DOUBLE:
261433 AppendValueInternal<T, double>(col, input);
261434 break;
261435 case LogicalTypeId::DECIMAL:
261436 switch (col.GetType().InternalType()) {
261437 case PhysicalType::INT16:
261438 AppendDecimalValueInternal<T, int16_t>(col, input);
261439 break;
261440 case PhysicalType::INT32:
261441 AppendDecimalValueInternal<T, int32_t>(col, input);
261442 break;
261443 case PhysicalType::INT64:
261444 AppendDecimalValueInternal<T, int64_t>(col, input);
261445 break;
261446 case PhysicalType::INT128:
261447 AppendDecimalValueInternal<T, hugeint_t>(col, input);
261448 break;
261449 default:
261450 throw InternalException("Internal type not recognized for Decimal");
261451 }
261452 break;
261453 case LogicalTypeId::DATE:
261454 AppendValueInternal<T, date_t>(col, input);
261455 break;
261456 case LogicalTypeId::TIMESTAMP:
261457 case LogicalTypeId::TIMESTAMP_TZ:
261458 AppendValueInternal<T, timestamp_t>(col, input);
261459 break;
261460 case LogicalTypeId::TIME:
261461 AppendValueInternal<T, dtime_t>(col, input);
261462 break;
261463 case LogicalTypeId::TIME_NS:
261464 AppendValueInternal<T, dtime_ns_t>(col, input);
261465 break;
261466 case LogicalTypeId::TIME_TZ:
261467 AppendValueInternal<T, dtime_tz_t>(col, input);
261468 break;
261469 case LogicalTypeId::INTERVAL:
261470 AppendValueInternal<T, interval_t>(col, input);
261471 break;
261472 case LogicalTypeId::VARCHAR:
261473 FlatVector::GetData<string_t>(col)[chunk.size()] = StringCast::Operation<T>(input, col);
261474 break;
261475 default:
261476 AppendValue(Value::CreateValue<T>(input));
261477 return;
261478 }
261479 column++;
261480}
@ INT64
Signed 64-bit little-endian integer.
Definition duckdb.hpp:2767
@ INT16
Signed 16-bit little-endian integer.
Definition duckdb.hpp:2755
@ INT32
Signed 32-bit little-endian integer.
Definition duckdb.hpp:2761

◆ AppendValueInternal() [2/2]

template<class SRC, class DST>
void duckdb::BaseAppender::AppendValueInternal ( Vector & vector,
SRC input )
protected
261363 {
261364 FlatVector::GetData<DST>(col)[chunk.size()] = Cast::Operation<SRC, DST>(input);
261365}

◆ AppendDecimalValueInternal()

template<class SRC, class DST>
void duckdb::BaseAppender::AppendDecimalValueInternal ( Vector & vector,
SRC input )
protected
261368 {
261369 switch (appender_type) {
261370 case AppenderType::LOGICAL: {
261371 auto &type = col.GetType();
261372 D_ASSERT(type.id() == LogicalTypeId::DECIMAL);
261373 auto width = DecimalType::GetWidth(type);
261374 auto scale = DecimalType::GetScale(type);
261375 CastParameters parameters;
261376 auto &result = FlatVector::GetData<DST>(col)[chunk.size()];
261377 TryCastToDecimal::Operation<SRC, DST>(input, result, parameters, width, scale);
261378 return;
261379 }
261380 case AppenderType::PHYSICAL: {
261381 AppendValueInternal<SRC, DST>(col, input);
261382 return;
261383 }
261384 default:
261385 throw InternalException("Type not implemented for AppenderType");
261386 }
261387}
AppenderType appender_type
The type of the appender.
Definition duckdb.hpp:54347
void scale(cv::Mat &mat, const cv::Mat &range, const T min, const T max)

◆ AppendRowRecursive() [1/2]

void duckdb::BaseAppender::AppendRowRecursive ( )
inlineprotected
54421 {
54422 EndRow();
54423 }
DUCKDB_API void EndRow()
Finishes appending the current row.
Definition duckdb.cpp:261350

◆ AppendRowRecursive() [2/2]

template<typename T, typename... ARGS>
void duckdb::BaseAppender::AppendRowRecursive ( T value,
ARGS... args )
inlineprotected
54426 {
54427 Append<T>(value);
54428 AppendRowRecursive(args...);
54429 }

◆ AppendValue()

void duckdb::BaseAppender::AppendValue ( const Value & value)
protected
261620 {
261621 chunk.SetValue(column, chunk.size(), value);
261622 column++;
261623}

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