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::VectorStringToList Struct Reference

Static Public Member Functions

static idx_t CountPartsList (const string_t &input)
static bool SplitStringList (const string_t &input, string_t *child_data, idx_t &child_start, Vector &child)
static bool StringToNestedTypeCastLoop (const string_t *source_data, ValidityMask &source_mask, Vector &result, ValidityMask &result_mask, idx_t count, CastParameters &parameters, const SelectionVector *sel)

Member Function Documentation

◆ CountPartsList()

idx_t duckdb::VectorStringToList::CountPartsList ( const string_t & input)
static
219210 {
219211 CountPartOperation state;
219213 return state.count;
219214}
static bool SplitStringListInternal(const string_t &input, OP &state)
Definition duckdb.cpp:219154

◆ SplitStringList()

bool duckdb::VectorStringToList::SplitStringList ( const string_t & input,
string_t * child_data,
idx_t & child_start,
Vector & child )
static
219205 {
219206 SplitStringListOperation state(child_data, child_start, child);
219208}

◆ StringToNestedTypeCastLoop()

bool duckdb::VectorStringToList::StringToNestedTypeCastLoop ( const string_t * source_data,
ValidityMask & source_mask,
Vector & result,
ValidityMask & result_mask,
idx_t count,
CastParameters & parameters,
const SelectionVector * sel )
static
214752 {
214753 idx_t total_list_size = 0;
214754 for (idx_t i = 0; i < count; i++) {
214755 idx_t idx = i;
214756 if (sel) {
214757 idx = sel->get_index(i);
214758 }
214759 if (!source_mask.RowIsValid(idx)) {
214760 continue;
214761 }
214762 total_list_size += VectorStringToList::CountPartsList(source_data[idx]);
214763 }
214764
214765 Vector varchar_vector(LogicalType::VARCHAR, total_list_size);
214766
214767 ListVector::Reserve(result, total_list_size);
214768 ListVector::SetListSize(result, total_list_size);
214769
214770 auto list_data = ListVector::GetData(result);
214771 auto child_data = FlatVector::GetData<string_t>(varchar_vector);
214772
214773 VectorTryCastData vector_cast_data(result, parameters);
214774 idx_t total = 0;
214775 for (idx_t i = 0; i < count; i++) {
214776 idx_t idx = i;
214777 if (sel) {
214778 idx = sel->get_index(i);
214779 }
214780 if (!source_mask.RowIsValid(idx)) {
214781 result_mask.SetInvalid(i);
214782 continue;
214783 }
214784
214785 list_data[i].offset = total;
214786 if (!VectorStringToList::SplitStringList(source_data[idx], child_data, total, varchar_vector)) {
214787 auto error = StringUtil::Format("Type VARCHAR with value '%s' can't be cast to the destination type %s",
214788 source_data[idx].GetString(), result.GetType().ToString());
214789 HandleVectorCastError::Operation<string_t>(error, result_mask, i, vector_cast_data);
214790 }
214791 list_data[i].length = total - list_data[i].offset; // length is the amount of parts coming from this string
214792 }
214793 D_ASSERT(total_list_size == total);
214794
214795 auto &result_child = ListVector::GetEntry(result);
214796 auto &cast_data = parameters.cast_data->Cast<ListBoundCastData>();
214797 CastParameters child_parameters(parameters, cast_data.child_cast_info.cast_data, parameters.local_state);
214798 bool all_converted =
214799 cast_data.child_cast_info.function(varchar_vector, result_child, total_list_size, child_parameters) &&
214800 vector_cast_data.all_converted;
214801 if (!all_converted && parameters.nullify_parent) {
214802 UnifiedVectorFormat inserted_column_data;
214803 result_child.ToUnifiedFormat(total_list_size, inserted_column_data);
214804 UnifiedVectorFormat parse_column_data;
214805 varchar_vector.ToUnifiedFormat(total_list_size, parse_column_data);
214806 // Something went wrong in the conversion, we need to nullify the parent
214807 for (idx_t i = 0; i < count; i++) {
214808 for (idx_t j = list_data[i].offset; j < list_data[i].offset + list_data[i].length; j++) {
214809 if (!inserted_column_data.validity.RowIsValid(j) && parse_column_data.validity.RowIsValid(j)) {
214810 result_mask.SetInvalid(i);
214811 break;
214812 }
214813 }
214814 }
214815 }
214816 return all_converted;
214817}
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
static DUCKDB_API const Vector & GetEntry(const Vector &vector)
Gets a reference to the underlying child-vector of a list.
Definition duckdb.cpp:138203
static DUCKDB_API void SetListSize(Vector &vec, idx_t size)
Sets the total size of the underlying child-vector of a list.
Definition duckdb.cpp:138248
static DUCKDB_API void Reserve(Vector &vec, idx_t required_capacity)
Sets the total capacity of the underlying child-vector of a list.
Definition duckdb.cpp:138211

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