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::ArrowListData< BUFTYPE > Struct Template Reference

Static Public Member Functions

static void Initialize (ArrowAppendData &result, const LogicalType &type, idx_t capacity)
 
static void Append (ArrowAppendData &append_data, Vector &input, idx_t from, idx_t to, idx_t input_size)
 
static void Finalize (ArrowAppendData &append_data, const LogicalType &type, ArrowArray *result)
 
static void AppendOffsets (ArrowAppendData &append_data, UnifiedVectorFormat &format, idx_t from, idx_t to, vector< sel_t > &child_sel)
 

Member Function Documentation

◆ Initialize()

template<class BUFTYPE = int64_t>
static void duckdb::ArrowListData< BUFTYPE >::Initialize ( ArrowAppendData result,
const LogicalType type,
idx_t  capacity 
)
inlinestatic
33533 {
33534 auto &child_type = ListType::GetChildType(type);
33535 result.GetMainBuffer().reserve((capacity + 1) * sizeof(BUFTYPE));
33536 auto child_buffer = ArrowAppender::InitializeChild(child_type, capacity, result.options);
33537 result.child_data.push_back(std::move(child_buffer));
33538 }

◆ Append()

template<class BUFTYPE = int64_t>
static void duckdb::ArrowListData< BUFTYPE >::Append ( ArrowAppendData append_data,
Vector input,
idx_t  from,
idx_t  to,
idx_t  input_size 
)
inlinestatic
33540 {
33541 UnifiedVectorFormat format;
33542 input.ToUnifiedFormat(input_size, format);
33543 idx_t size = to - from;
33544 vector<sel_t> child_indices;
33545 append_data.AppendValidity(format, from, to);
33546 AppendOffsets(append_data, format, from, to, child_indices);
33547
33548 // append the child vector of the list
33549 SelectionVector child_sel(child_indices.data());
33550 auto &child = ListVector::GetEntry(input);
33551 auto child_size = child_indices.size();
33552 Vector child_copy(child.GetType());
33553 child_copy.Slice(child, child_sel, child_size);
33554 append_data.child_data[0]->append_vector(*append_data.child_data[0], child_copy, 0, child_size, child_size);
33555 append_data.row_count += size;
33556 }
GOpaque< Size > size(const GMat &src)
static DUCKDB_API const Vector & GetEntry(const Vector &vector)
Gets a reference to the underlying child-vector of a list.

◆ Finalize()

template<class BUFTYPE = int64_t>
static void duckdb::ArrowListData< BUFTYPE >::Finalize ( ArrowAppendData append_data,
const LogicalType type,
ArrowArray result 
)
inlinestatic
33558 {
33559 result->n_buffers = 2;
33560 result->buffers[1] = append_data.GetMainBuffer().data();
33561
33562 auto &child_type = ListType::GetChildType(type);
33563 ArrowAppender::AddChildren(append_data, 1);
33564 result->children = append_data.child_pointers.data();
33565 result->n_children = 1;
33566 append_data.child_arrays[0] = *ArrowAppender::FinalizeChild(child_type, std::move(append_data.child_data[0]));
33567 }

◆ AppendOffsets()

template<class BUFTYPE = int64_t>
static void duckdb::ArrowListData< BUFTYPE >::AppendOffsets ( ArrowAppendData append_data,
UnifiedVectorFormat format,
idx_t  from,
idx_t  to,
vector< sel_t > &  child_sel 
)
inlinestatic
33571 {
33572 // resize the offset buffer - the offset buffer holds the offsets into the child array
33573 idx_t size = to - from;
33574 auto &main_buffer = append_data.GetMainBuffer();
33575
33576 main_buffer.resize(main_buffer.size() + sizeof(BUFTYPE) * (size + 1));
33577 auto data = UnifiedVectorFormat::GetData<list_entry_t>(format);
33578 auto offset_data = main_buffer.GetData<BUFTYPE>();
33579 if (append_data.row_count == 0) {
33580 // first entry
33581 offset_data[0] = 0;
33582 }
33583 // set up the offsets using the list entries
33584 auto last_offset = offset_data[append_data.row_count];
33585 for (idx_t i = from; i < to; i++) {
33586 auto source_idx = format.sel->get_index(i);
33587 auto offset_idx = append_data.row_count + i + 1 - from;
33588
33589 if (!format.validity.RowIsValid(source_idx)) {
33590 offset_data[offset_idx] = last_offset;
33591 continue;
33592 }
33593
33594 // append the offset data
33595 auto list_length = data[source_idx].length;
33596 if (std::is_same<BUFTYPE, int32_t>::value == true &&
33597 (uint64_t)last_offset + list_length > NumericLimits<int32_t>::Maximum()) {
33598 throw InvalidInputException(
33599 "Arrow Appender: The maximum combined list offset for regular list buffers is "
33600 "%u but the offset of %lu exceeds this.\n* SET arrow_large_buffer_size=true to use large list "
33601 "buffers",
33602 NumericLimits<int32_t>::Maximum(), last_offset);
33603 }
33604 last_offset += list_length;
33605 offset_data[offset_idx] = last_offset;
33606
33607 for (idx_t k = 0; k < list_length; k++) {
33608 child_sel.push_back(UnsafeNumericCast<sel_t>(data[source_idx].offset + k));
33609 }
33610 }
33611 }
::uint64_t uint64_t

The documentation for this struct was generated from the following file: