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

Static Public Member Functions

static DUCKDB_API bool IsFullyShredded (const BaseStatistics &stats)
static DUCKDB_API optional_ptr< const BaseStatistics > FindChildStats (const BaseStatistics &stats, const VariantPathComponent &component)

Member Function Documentation

◆ IsFullyShredded()

bool duckdb::VariantShreddedStats::IsFullyShredded ( const BaseStatistics & stats)
static

Fully shredded, no nulls

In the event that the untyped_value_index is entirely NULL, all values are NULL Variant values But that doesn't mean we can't do pushdown into this field, so it is shredded (only when the extract path ends at the parent we can't do pushdown)

Has no min/max values, essentially double-checking the CanHaveNoNull from above

Not a constant

0 is reserved for missing values (field absent from parent object)

425169 {
425170 auto &stats_type = stats.GetType();
425171 if (!stats_type.IsNested()) {
425172 // if this is a primitive type this is fully nested
425173 return true;
425174 }
425175 AssertShreddedStats(stats);
425176 if (StructType::GetChildCount(stats_type) == 1) {
425177 // we don't have untyped values - this must be fully shredded
425178 return true;
425179 }
425180
425181 auto &typed_value_stats = StructStats::GetChildStats(stats, VariantStats::TYPED_VALUE_INDEX);
425182 auto &untyped_value_index_stats = StructStats::GetChildStats(stats, VariantStats::UNTYPED_VALUE_INDEX);
425183
425184 if (!typed_value_stats.CanHaveNull()) {
425186 return true;
425187 }
425188 if (!untyped_value_index_stats.CanHaveNoNull()) {
425192 D_ASSERT(untyped_value_index_stats.CanHaveNull());
425193 return true;
425194 }
425195 if (!NumericStats::HasMin(untyped_value_index_stats) || !NumericStats::HasMax(untyped_value_index_stats)) {
425197 return false;
425198 }
425199 auto min_value = NumericStats::GetMinUnsafe<uint32_t>(untyped_value_index_stats);
425200 auto max_value = NumericStats::GetMaxUnsafe<uint32_t>(untyped_value_index_stats);
425201 if (min_value != max_value) {
425203 return false;
425204 }
425206 return min_value == 0;
425207}
static DUCKDB_API bool HasMin(const BaseStatistics &stats)
Returns true if the stats has a min value defined.
Definition duckdb.cpp:424242
static DUCKDB_API bool HasMax(const BaseStatistics &stats)
Returns true if the stats has a max value defined.
Definition duckdb.cpp:424249
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindChildStats()

optional_ptr< const BaseStatistics > duckdb::VariantShreddedStats::FindChildStats ( const BaseStatistics & stats,
const VariantPathComponent & component )
static
425129 {
425130 const_reference<BaseStatistics> typed_value_stats_ref(stats);
425131 const_reference<LogicalType> typed_value_type_ref(stats.GetType());
425132 if (typed_value_type_ref.get().IsNested()) {
425133 // "typed_value" / "untyped_value"
425134 AssertShreddedStats(stats);
425135
425136 typed_value_stats_ref = StructStats::GetChildStats(stats, VariantStats::TYPED_VALUE_INDEX);
425137 typed_value_type_ref = typed_value_stats_ref.get().GetType();
425138 }
425139 auto &typed_value_stats = typed_value_stats_ref.get();
425140 auto &typed_value_type = typed_value_type_ref.get();
425141
425142 switch (component.lookup_mode) {
425143 case VariantChildLookupMode::BY_INDEX: {
425144 if (typed_value_type.id() != LogicalTypeId::LIST) {
425145 return nullptr;
425146 }
425147 auto &child_stats = ListStats::GetChildStats(typed_value_stats);
425148 return child_stats;
425149 }
425150 case VariantChildLookupMode::BY_KEY: {
425151 if (typed_value_type.id() != LogicalTypeId::STRUCT) {
425152 return nullptr;
425153 }
425154 auto &object_fields = StructType::GetChildTypes(typed_value_type);
425155 for (idx_t i = 0; i < object_fields.size(); i++) {
425156 auto &object_field = object_fields[i];
425157 if (StringUtil::CIEquals(object_field.first, component.key)) {
425158 return StructStats::GetChildStats(typed_value_stats, i);
425159 }
425160 }
425161 return nullptr;
425162 }
425163 default:
425164 throw InternalException("VariantChildLookupMode::%s not implemented for FindShreddedStats",
425165 EnumUtil::ToString(component.lookup_mode));
425166 }
425167}
static DUCKDB_API bool CIEquals(const string &l1, const string &l2)
Case insensitive equals.
Definition duckdb.cpp:109696
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

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