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

Public Member Functions

 ConstantFilter (ExpressionType comparison_type, Value constant)
bool Compare (const Value &value) const
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

ExpressionType comparison_type
 The comparison type (e.g. COMPARE_EQUAL, COMPARE_GREATERTHAN, COMPARE_LESSTHAN, ...).
Value constant
 The constant value to filter on.
Public Attributes inherited from duckdb::TableFilter
TableFilterType filter_type

Static Public Attributes

static constexpr const TableFilterType TYPE = TableFilterType::CONSTANT_COMPARISON

Constructor & Destructor Documentation

◆ ConstantFilter()

duckdb::ConstantFilter::ConstantFilter ( ExpressionType comparison_type,
Value constant )
379762 : TableFilter(TableFilterType::CONSTANT_COMPARISON), comparison_type(comparison_type_p),
379763 constant(std::move(constant_p)) {
379764 if (constant.IsNull()) {
379765 throw InternalException("ConstantFilter constant cannot be NULL - use IsNullFilter instead");
379766 }
379767}
Value constant
The constant value to filter on.
Definition duckdb.hpp:47361
ExpressionType comparison_type
The comparison type (e.g. COMPARE_EQUAL, COMPARE_GREATERTHAN, COMPARE_LESSTHAN, .....
Definition duckdb.hpp:47359

Member Function Documentation

◆ Compare()

bool duckdb::ConstantFilter::Compare ( const Value & value) const
379769 {
379770 switch (comparison_type) {
379771 case ExpressionType::COMPARE_EQUAL:
379772 return ValueOperations::Equals(value, constant);
379773 case ExpressionType::COMPARE_NOTEQUAL:
379774 return ValueOperations::NotEquals(value, constant);
379775 case ExpressionType::COMPARE_GREATERTHAN:
379776 return ValueOperations::GreaterThan(value, constant);
379777 case ExpressionType::COMPARE_GREATERTHANOREQUALTO:
379778 return ValueOperations::GreaterThanEquals(value, constant);
379779 case ExpressionType::COMPARE_LESSTHAN:
379780 return ValueOperations::LessThan(value, constant);
379781 case ExpressionType::COMPARE_LESSTHANOREQUALTO:
379782 return ValueOperations::LessThanEquals(value, constant);
379783 default:
379784 throw InternalException("unknown comparison type for ConstantFilter: " + EnumUtil::ToString(comparison_type));
379785 }
379786}

◆ CheckStatistics()

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

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

Implements duckdb::TableFilter.

379788 {
379789 if (!stats.CanHaveNoNull()) {
379790 // no non-null values are possible: always false
379791 return FilterPropagateResult::FILTER_ALWAYS_FALSE;
379792 }
379793 FilterPropagateResult result;
379794 D_ASSERT(constant.type().id() == stats.GetType().id());
379795 switch (constant.type().InternalType()) {
379796 case PhysicalType::UINT8:
379800 case PhysicalType::UINT128:
379801 case PhysicalType::INT8:
379802 case PhysicalType::INT16:
379803 case PhysicalType::INT32:
379804 case PhysicalType::INT64:
379805 case PhysicalType::INT128:
379806 case PhysicalType::FLOAT:
379808 result = NumericStats::CheckZonemap(stats, comparison_type, array_ptr<const Value>(&constant, 1));
379809 break;
379811 switch (stats.GetStatsType()) {
379812 case StatisticsType::STRING_STATS:
379813 result = StringStats::CheckZonemap(stats, comparison_type, array_ptr<const Value>(&constant, 1));
379814 break;
379815 default:
379816 return FilterPropagateResult::NO_PRUNING_POSSIBLE;
379817 }
379818 break;
379819 default:
379820 return FilterPropagateResult::NO_PRUNING_POSSIBLE;
379821 }
379822 if (result == FilterPropagateResult::FILTER_ALWAYS_TRUE) {
379823 // the numeric filter is always true, but the column can have NULL values
379824 // we can't prune the filter
379825 if (stats.CanHaveNull()) {
379826 return FilterPropagateResult::NO_PRUNING_POSSIBLE;
379827 }
379828 }
379829 return result;
379830}
@ 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::ConstantFilter::ToString ( const string & column_name) const
overridevirtual

Implements duckdb::TableFilter.

379832 {
379833 return column_name + ExpressionTypeToOperator(comparison_type) + constant.ToSQLString();
379834}

◆ Equals()

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

Reimplemented from duckdb::TableFilter.

379842 {
379843 if (!TableFilter::Equals(other_p)) {
379844 return false;
379845 }
379846 auto &other = other_p.Cast<ConstantFilter>();
379847 return other.comparison_type == comparison_type && other.constant == constant;
379848}

◆ Copy()

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

Implements duckdb::TableFilter.

379850 {
379851 return make_uniq<ConstantFilter>(comparison_type, constant);
379852}

◆ ToExpression()

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

Implements duckdb::TableFilter.

379836 {
379837 auto bound_constant = make_uniq<BoundConstantExpression>(constant);
379838 auto result = make_uniq<BoundComparisonExpression>(comparison_type, column.Copy(), std::move(bound_constant));
379839 return std::move(result);
379840}

◆ Serialize()

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

Reimplemented from duckdb::TableFilter.

419487 {
419488 TableFilter::Serialize(serializer);
419489 serializer.WriteProperty<ExpressionType>(200, "comparison_type", comparison_type);
419490 serializer.WriteProperty<Value>(201, "constant", constant);
419491}

◆ Deserialize()

unique_ptr< TableFilter > duckdb::ConstantFilter::Deserialize ( Deserializer & deserializer)
static
419493 {
419494 auto comparison_type = deserializer.ReadProperty<ExpressionType>(200, "comparison_type");
419495 auto constant = deserializer.ReadProperty<Value>(201, "constant");
419496 auto result = duckdb::unique_ptr<ConstantFilter>(new ConstantFilter(comparison_type, constant));
419497 return std::move(result);
419498}

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