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::LogicalSample Class Reference

LogicalSample represents a SAMPLE clause. More...

Inheritance diagram for duckdb::LogicalSample:
Collaboration diagram for duckdb::LogicalSample:

Public Member Functions

 LogicalSample (unique_ptr< SampleOptions > sample_options_p, unique_ptr< LogicalOperator > child)
vector< ColumnBinding > GetColumnBindings () override
idx_t EstimateCardinality (ClientContext &context) override
void Serialize (Serializer &serializer) const override
Public Member Functions inherited from duckdb::LogicalOperator
 LogicalOperator (LogicalOperatorType type)
 LogicalOperator (LogicalOperatorType type, vector< unique_ptr< Expression > > expressions)
virtual idx_t GetRootIndex ()
void PrintColumnBindings ()
void ResolveOperatorTypes ()
 Resolve the types of the logical operator and its children.
virtual string GetName () const
virtual InsertionOrderPreservingMap< string > ParamsToString () const
virtual string ToString (ExplainFormat format=ExplainFormat::DEFAULT) const
DUCKDB_API void Print ()
virtual void Verify (ClientContext &context)
 Debug method: verify that the integrity of expressions & child nodes are maintained.
void AddChild (unique_ptr< LogicalOperator > child)
void SetEstimatedCardinality (idx_t _estimated_cardinality)
void SetParamsEstimatedCardinality (InsertionOrderPreservingMap< string > &result) const
virtual unique_ptr< LogicalOperator > Copy (ClientContext &context) const
virtual bool RequireOptimizer () const
virtual bool SupportSerialization () const
 Allows LogicalOperators to opt out of serialization.
virtual bool HasProjectionMap () const
virtual vector< idx_t > GetTableIndex () const
 Returns the set of table indexes of this operator.
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Static Public Member Functions

static unique_ptr< LogicalOperator > Deserialize (Deserializer &deserializer)
Static Public Member Functions inherited from duckdb::LogicalOperator
static string ColumnBindingsToString (const vector< ColumnBinding > &bindings)
static vector< ColumnBinding > GenerateColumnBindings (idx_t table_idx, idx_t column_count)
static vector< LogicalType > MapTypes (const vector< LogicalType > &types, const vector< idx_t > &projection_map)
static vector< ColumnBinding > MapBindings (const vector< ColumnBinding > &types, const vector< idx_t > &projection_map)
static unique_ptr< LogicalOperator > Deserialize (Deserializer &deserializer)

Public Attributes

unique_ptr< SampleOptions > sample_options
 The sample options.
Public Attributes inherited from duckdb::LogicalOperator
LogicalOperatorType type
 The type of the logical operator.
vector< unique_ptr< LogicalOperator > > children
 The set of children of the operator.
vector< unique_ptr< Expression > > expressions
 The set of expressions contained within the operator, if any.
vector< LogicalType > types
 The types returned by this logical operator. Set by calling LogicalOperator::ResolveTypes.
idx_t estimated_cardinality
 Estimated Cardinality.
bool has_estimated_cardinality

Static Public Attributes

static constexpr const LogicalOperatorType TYPE = LogicalOperatorType::LOGICAL_SAMPLE

Protected Member Functions

void ResolveTypes () override
 Resolve types for this specific operator.

Detailed Description

LogicalSample represents a SAMPLE clause.

Constructor & Destructor Documentation

◆ LogicalSample() [1/2]

duckdb::LogicalSample::LogicalSample ( unique_ptr< SampleOptions > sample_options_p,
unique_ptr< LogicalOperator > child )
383014 : LogicalOperator(LogicalOperatorType::LOGICAL_SAMPLE), sample_options(std::move(sample_options_p)) {
383015 children.push_back(std::move(child));
383016}
vector< unique_ptr< LogicalOperator > > children
The set of children of the operator.
Definition duckdb.hpp:21262
unique_ptr< SampleOptions > sample_options
The sample options.
Definition duckdb.cpp:205870

◆ LogicalSample() [2/2]

duckdb::LogicalSample::LogicalSample ( )
private
383010 : LogicalOperator(LogicalOperatorType::LOGICAL_SAMPLE) {
383011}

Member Function Documentation

◆ GetColumnBindings()

vector< ColumnBinding > duckdb::LogicalSample::GetColumnBindings ( )
overridevirtual

Reimplemented from duckdb::LogicalOperator.

383018 {
383019 return children[0]->GetColumnBindings();
383020}

◆ EstimateCardinality()

idx_t duckdb::LogicalSample::EstimateCardinality ( ClientContext & context)
overridevirtual

Reimplemented from duckdb::LogicalOperator.

383022 {
383023 auto child_cardinality = children[0]->EstimateCardinality(context);
383024 if (sample_options->is_percentage) {
383025 double sample_cardinality =
383026 double(child_cardinality) * (sample_options->sample_size.GetValue<double>() / 100.0);
383027 if (sample_cardinality > double(child_cardinality)) {
383028 return child_cardinality;
383029 }
383030 return idx_t(sample_cardinality);
383031 } else {
383032 auto sample_size = sample_options->sample_size.GetValue<uint64_t>();
383033 if (sample_size < child_cardinality) {
383034 return sample_size;
383035 }
383036 }
383037 return child_cardinality;
383038}
::uint64_t uint64_t
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ Serialize()

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

Reimplemented from duckdb::LogicalOperator.

416990 {
416991 LogicalOperator::Serialize(serializer);
416992 serializer.WritePropertyWithDefault<unique_ptr<SampleOptions>>(200, "sample_options", sample_options);
416993}

◆ Deserialize()

unique_ptr< LogicalOperator > duckdb::LogicalSample::Deserialize ( Deserializer & deserializer)
static
416995 {
416996 auto result = duckdb::unique_ptr<LogicalSample>(new LogicalSample());
416997 deserializer.ReadPropertyWithDefault<unique_ptr<SampleOptions>>(200, "sample_options", result->sample_options);
416998 return std::move(result);
416999}

◆ ResolveTypes()

void duckdb::LogicalSample::ResolveTypes ( )
overrideprotectedvirtual

Resolve types for this specific operator.

Implements duckdb::LogicalOperator.

383040 {
383041 types = children[0]->types;
383042}
vector< LogicalType > types
The types returned by this logical operator. Set by calling LogicalOperator::ResolveTypes.
Definition duckdb.hpp:21266

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