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

Static Public Member Functions

static DUCKDB_API void Construct (BaseStatistics &stats)
static DUCKDB_API BaseStatistics CreateUnknown (LogicalType type)
static DUCKDB_API BaseStatistics CreateEmpty (LogicalType type)
static DUCKDB_API const BaseStatistics & GetChildStats (const BaseStatistics &stats)
static DUCKDB_API BaseStatistics & GetChildStats (BaseStatistics &stats)
static DUCKDB_API void SetChildStats (BaseStatistics &stats, unique_ptr< BaseStatistics > new_stats)
static DUCKDB_API void Serialize (const BaseStatistics &stats, Serializer &serializer)
static DUCKDB_API void Deserialize (Deserializer &deserializer, BaseStatistics &base)
static DUCKDB_API string ToString (const BaseStatistics &stats)
static DUCKDB_API void Merge (BaseStatistics &stats, const BaseStatistics &other)
static DUCKDB_API void Copy (BaseStatistics &stats, const BaseStatistics &other)
static DUCKDB_API void Verify (const BaseStatistics &stats, Vector &vector, const SelectionVector &sel, idx_t count)

Member Function Documentation

◆ Construct()

void duckdb::ArrayStats::Construct ( BaseStatistics & stats)
static
422521 {
422522 stats.child_stats = unsafe_unique_array<BaseStatistics>(new BaseStatistics[1]);
422523 BaseStatistics::Construct(stats.child_stats[0], ArrayType::GetChildType(stats.GetType()));
422524}

◆ CreateUnknown()

BaseStatistics duckdb::ArrayStats::CreateUnknown ( LogicalType type)
static
422526 {
422527 auto &child_type = ArrayType::GetChildType(type);
422528 BaseStatistics result(std::move(type));
422529 result.InitializeUnknown();
422530 result.child_stats[0].Copy(BaseStatistics::CreateUnknown(child_type));
422531 return result;
422532}
static BaseStatistics CreateUnknown(LogicalType type)
Definition duckdb.cpp:422865

◆ CreateEmpty()

BaseStatistics duckdb::ArrayStats::CreateEmpty ( LogicalType type)
static
422534 {
422535 auto &child_type = ArrayType::GetChildType(type);
422536 BaseStatistics result(std::move(type));
422537 result.InitializeEmpty();
422538 result.child_stats[0].Copy(BaseStatistics::CreateEmpty(child_type));
422539 return result;
422540}
static BaseStatistics CreateEmpty(LogicalType type)
Definition duckdb.cpp:422871

◆ GetChildStats() [1/2]

const BaseStatistics & duckdb::ArrayStats::GetChildStats ( const BaseStatistics & stats)
static
422548 {
422549 if (stats.GetStatsType() != StatisticsType::ARRAY_STATS) {
422550 throw InternalException("ArrayStats::GetChildStats called on stats that is not a array");
422551 }
422552 D_ASSERT(stats.child_stats);
422553 return stats.child_stats[0];
422554}

◆ GetChildStats() [2/2]

BaseStatistics & duckdb::ArrayStats::GetChildStats ( BaseStatistics & stats)
static
422555 {
422556 if (stats.GetStatsType() != StatisticsType::ARRAY_STATS) {
422557 throw InternalException("ArrayStats::GetChildStats called on stats that is not a array");
422558 }
422559 D_ASSERT(stats.child_stats);
422560 return stats.child_stats[0];
422561}

◆ SetChildStats()

void duckdb::ArrayStats::SetChildStats ( BaseStatistics & stats,
unique_ptr< BaseStatistics > new_stats )
static
422563 {
422564 if (!new_stats) {
422565 stats.child_stats[0].Copy(BaseStatistics::CreateUnknown(ArrayType::GetChildType(stats.GetType())));
422566 } else {
422567 stats.child_stats[0].Copy(*new_stats);
422568 }
422569}

◆ Serialize()

void duckdb::ArrayStats::Serialize ( const BaseStatistics & stats,
Serializer & serializer )
static
422581 {
422582 auto &child_stats = ArrayStats::GetChildStats(stats);
422583 serializer.WriteProperty(200, "child_stats", child_stats);
422584}

◆ Deserialize()

void duckdb::ArrayStats::Deserialize ( Deserializer & deserializer,
BaseStatistics & base )
static
422586 {
422587 auto &type = base.GetType();
422588 D_ASSERT(type.id() == LogicalTypeId::ARRAY);
422589 auto &child_type = ArrayType::GetChildType(type);
422590
422591 // Push the logical type of the child type to the deserialization context
422592 deserializer.Set<const LogicalType &>(child_type);
422593 base.child_stats[0].Copy(deserializer.ReadProperty<BaseStatistics>(200, "child_stats"));
422594 deserializer.Unset<LogicalType>();
422595}

◆ ToString()

string duckdb::ArrayStats::ToString ( const BaseStatistics & stats)
static
422597 {
422598 auto &child_stats = ArrayStats::GetChildStats(stats);
422599 return StringUtil::Format("[%s]", child_stats.ToString());
422600}
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002

◆ Merge()

void duckdb::ArrayStats::Merge ( BaseStatistics & stats,
const BaseStatistics & other )
static
422571 {
422572 if (other.GetType().id() == LogicalTypeId::VALIDITY) {
422573 return;
422574 }
422575
422576 auto &child_stats = ArrayStats::GetChildStats(stats);
422577 auto &other_child_stats = ArrayStats::GetChildStats(other);
422578 child_stats.Merge(other_child_stats);
422579}

◆ Copy()

void duckdb::ArrayStats::Copy ( BaseStatistics & stats,
const BaseStatistics & other )
static
422542 {
422543 D_ASSERT(stats.child_stats);
422544 D_ASSERT(other.child_stats);
422545 stats.child_stats[0].Copy(other.child_stats[0]);
422546}

◆ Verify()

void duckdb::ArrayStats::Verify ( const BaseStatistics & stats,
Vector & vector,
const SelectionVector & sel,
idx_t count )
static
422602 {
422603 auto &child_stats = ArrayStats::GetChildStats(stats);
422604 auto &child_entry = ArrayVector::GetEntry(vector);
422605 auto array_size = ArrayType::GetSize(vector.GetType());
422606
422607 UnifiedVectorFormat vdata;
422608 vector.ToUnifiedFormat(count, vdata);
422609
422610 // Basically,
422611 // 1. Count the number of valid arrays
422612 // 2. Create a selection vector with the size of the number of valid arrays * array_size
422613 // 3. Fill the selection vector with the offsets of all the elements in the child vector
422614 // that exist in each valid array
422615 // 4. Use that selection vector to verify the child stats
422616
422617 idx_t valid_count = 0;
422618 for (idx_t i = 0; i < count; i++) {
422619 auto idx = sel.get_index(i);
422620 auto index = vdata.sel->get_index(idx);
422621 if (vdata.validity.RowIsValid(index)) {
422622 valid_count++;
422623 }
422624 }
422625
422626 SelectionVector element_sel(valid_count * array_size);
422627 idx_t element_count = 0;
422628 for (idx_t i = 0; i < count; i++) {
422629 auto idx = sel.get_index(i);
422630 auto index = vdata.sel->get_index(idx);
422631 auto offset = index * array_size;
422632 if (vdata.validity.RowIsValid(index)) {
422633 for (idx_t elem_idx = 0; elem_idx < array_size; elem_idx++) {
422634 element_sel.set_index(element_count++, offset + elem_idx);
422635 }
422636 }
422637 }
422638
422639 child_stats.Verify(child_entry, element_sel, element_count);
422640}
index
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 an array.
Definition duckdb.cpp:138574

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