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::InFilter Class Reference
Inheritance diagram for duckdb::InFilter:
Collaboration diagram for duckdb::InFilter:

Public Member Functions

 InFilter (vector< Value > values)
FilterPropagateResult CheckStatistics (BaseStatistics &stats) const override
 Returns true if the statistics indicate that the segment can contain values that satisfy that filter.
string ToString (const string &column_name) const override
bool Equals (const TableFilter &other) const override
unique_ptr< TableFilter > Copy () const override
unique_ptr< Expression > ToExpression (const Expression &column) const override
void Serialize (Serializer &serializer) const override
Public Member Functions inherited from duckdb::TableFilter
 TableFilter (TableFilterType filter_type_p)
string DebugToString () const
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Static Public Member Functions

static unique_ptr< TableFilter > Deserialize (Deserializer &deserializer)
Static Public Member Functions inherited from duckdb::TableFilter
static unique_ptr< TableFilter > Deserialize (Deserializer &deserializer)

Public Attributes

vector< Value > values
Public Attributes inherited from duckdb::TableFilter
TableFilterType filter_type

Static Public Attributes

static constexpr const TableFilterType TYPE = TableFilterType::IN_FILTER

Constructor & Destructor Documentation

◆ InFilter()

duckdb::InFilter::InFilter ( vector< Value > values)
explicit
380003 : TableFilter(TableFilterType::IN_FILTER), values(std::move(values_p)) {
380004 for (auto &val : values) {
380005 if (val.IsNull()) {
380006 throw InternalException("InFilter constant cannot be NULL - use IsNullFilter instead");
380007 }
380008 }
380009 for (idx_t i = 1; i < values.size(); i++) {
380010 if (values[0].type() != values[i].type()) {
380011 throw InternalException("InFilter constants must all have the same type");
380012 }
380013 }
380014 if (values.empty()) {
380015 throw InternalException("InFilter constants cannot be empty");
380016 }
380017}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

Member Function Documentation

◆ CheckStatistics()

FilterPropagateResult duckdb::InFilter::CheckStatistics ( BaseStatistics & stats) const
overridevirtual

Returns true if the statistics indicate that the segment can contain values that satisfy that filter.

Implements duckdb::TableFilter.

380019 {
380020 if (!stats.CanHaveNoNull()) {
380021 // no non-null values are possible: always false
380022 return FilterPropagateResult::FILTER_ALWAYS_FALSE;
380023 }
380024 switch (values[0].type().InternalType()) {
380025 case PhysicalType::UINT8:
380029 case PhysicalType::UINT128:
380030 case PhysicalType::INT8:
380031 case PhysicalType::INT16:
380032 case PhysicalType::INT32:
380033 case PhysicalType::INT64:
380034 case PhysicalType::INT128:
380035 case PhysicalType::FLOAT:
380037 return NumericStats::CheckZonemap(stats, ExpressionType::COMPARE_EQUAL,
380038 array_ptr<const Value>(values.data(), values.size()));
380040 return StringStats::CheckZonemap(stats, ExpressionType::COMPARE_EQUAL,
380041 array_ptr<const Value>(values.data(), values.size()));
380042 default:
380043 return FilterPropagateResult::NO_PRUNING_POSSIBLE;
380044 }
380045}
@ UINT32
Unsigned 32-bit little-endian integer.
Definition duckdb.hpp:2758
@ UINT16
Unsigned 16-bit little-endian integer.
Definition duckdb.hpp:2752
@ 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
@ UINT64
Unsigned 64-bit little-endian integer.
Definition duckdb.hpp:2764
@ VARCHAR
DuckDB Extensions.
Definition duckdb.hpp:2847
@ FLOAT
4-byte floating point value
Definition duckdb.hpp:2773
@ UINT8
Unsigned 8-bit little-endian integer.
Definition duckdb.hpp:2746
@ INT8
Signed 8-bit little-endian integer.
Definition duckdb.hpp:2749
@ DOUBLE
8-byte floating point value
Definition duckdb.hpp:2776
static DUCKDB_API FilterPropagateResult CheckZonemap(const BaseStatistics &stats, ExpressionType comparison_type, array_ptr< const Value > constants)
Check whether or not a given comparison with a constant could possibly be satisfied by rows given the...
Definition duckdb.cpp:424094
Here is the call graph for this function:

◆ ToString()

string duckdb::InFilter::ToString ( const string & column_name) const
overridevirtual

Implements duckdb::TableFilter.

380047 {
380048 string in_list;
380049 for (auto &val : values) {
380050 if (!in_list.empty()) {
380051 in_list += ", ";
380052 }
380053 in_list += val.ToSQLString();
380054 }
380055 return column_name + " IN (" + in_list + ")";
380056}

◆ Equals()

bool duckdb::InFilter::Equals ( const TableFilter & other) const
overridevirtual

Reimplemented from duckdb::TableFilter.

380067 {
380068 if (!TableFilter::Equals(other_p)) {
380069 return false;
380070 }
380071 auto &other = other_p.Cast<InFilter>();
380072 return other.values == values;
380073}

◆ Copy()

unique_ptr< TableFilter > duckdb::InFilter::Copy ( ) const
overridevirtual

Implements duckdb::TableFilter.

380075 {
380076 return make_uniq<InFilter>(values);
380077}

◆ ToExpression()

unique_ptr< Expression > duckdb::InFilter::ToExpression ( const Expression & column) const
overridevirtual

Implements duckdb::TableFilter.

380058 {
380059 auto result = make_uniq<BoundOperatorExpression>(ExpressionType::COMPARE_IN, LogicalType::BOOLEAN);
380060 result->children.push_back(column.Copy());
380061 for (auto &val : values) {
380062 result->children.push_back(make_uniq<BoundConstantExpression>(val));
380063 }
380064 return std::move(result);
380065}

◆ Serialize()

void duckdb::InFilter::Serialize ( Serializer & serializer) const
overridevirtual

Reimplemented from duckdb::TableFilter.

419520 {
419521 TableFilter::Serialize(serializer);
419522 serializer.WritePropertyWithDefault<vector<Value>>(200, "values", values);
419523}

◆ Deserialize()

unique_ptr< TableFilter > duckdb::InFilter::Deserialize ( Deserializer & deserializer)
static
419525 {
419526 auto values = deserializer.ReadPropertyWithDefault<vector<Value>>(200, "values");
419527 auto result = duckdb::unique_ptr<InFilter>(new InFilter(std::move(values)));
419528 return std::move(result);
419529}

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