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

Public Member Functions

 ReservoirSample (Allocator &allocator, idx_t sample_count, int64_t seed=1)
 
 ReservoirSample (idx_t sample_count, unique_ptr< ReservoirChunk >=nullptr)
 
void EvictOverBudgetSamples ()
 methods used to help with serializing and deserializing
 
void ExpandSerializedSample ()
 
SamplingState GetSamplingState () const
 
void Vacuum ()
 
void ConvertToReservoirSample ()
 Transform To sample based on reservoir sampling paper.
 
template<typename T >
GetReservoirChunkCapacity () const
 Get the capactiy of the data chunk reserved for storing samples.
 
unique_ptr< BlockingSampleCopy () const override
 
idx_t FillReservoir (DataChunk &chunk)
 create the first chunk called by AddToReservoir()
 
void AddToReservoir (DataChunk &input) override
 Add a chunk of data to the sample.
 
void Merge (unique_ptr< BlockingSample > other)
 Merge two Reservoir Samples. Other must be a reservoir sample.
 
void ShuffleSel (SelectionVector &sel, idx_t range, idx_t size) const
 
void UpdateSampleAppend (DataChunk &this_, DataChunk &other, SelectionVector &other_sel, idx_t append_count) const
 
idx_t GetTuplesSeen () const
 
idx_t NumSamplesCollected () const
 
idx_t GetActiveSampleCount () const
 
DataChunkChunk ()
 
unique_ptr< DataChunkGetChunk () override
 
void Destroy () override
 
void Finalize () override
 
void Verify ()
 
idx_t GetSampleCount ()
 
SelectionVectorHelper GetReplacementIndexes (idx_t sample_chunk_offset, idx_t theoretical_chunk_length)
 Get indexes from current sample that can be replaced.
 
void Serialize (Serializer &serializer) const override
 
- Public Member Functions inherited from duckdb::BlockingSample
 BlockingSample (int64_t seed=-1)
 
std::pair< double, idx_tPopFromWeightQueue ()
 Helper functions needed to merge two reservoirs while respecting weights of sampled rows.
 
double GetMinWeightThreshold ()
 
idx_t GetPriorityQueueSize ()
 
template<class TARGET >
TARGETCast ()
 
template<class TARGET >
const TARGETCast () const
 

Static Public Member Functions

static bool ValidSampleType (const LogicalType &type)
 
static unique_ptr< BlockingSampleDeserialize (Deserializer &deserializer)
 
- Static Public Member Functions inherited from duckdb::BlockingSample
static unique_ptr< BlockingSampleDeserialize (Deserializer &deserializer)
 

Static Public Attributes

static constexpr const SampleType TYPE = SampleType::RESERVOIR_SAMPLE
 
static constexpr idx_t FIXED_SAMPLE_SIZE_MULTIPLIER = 10
 
static constexpr idx_t FAST_TO_SLOW_THRESHOLD = MinValue<idx_t>(STANDARD_VECTOR_SIZE, 60)
 
static constexpr double SAVE_PERCENTAGE = 0.01
 
- Static Public Attributes inherited from duckdb::BlockingSample
static constexpr const SampleType TYPE = SampleType::BLOCKING_SAMPLE
 

Private Member Functions

void NormalizeWeights ()
 
SelectionVectorHelper GetReplacementIndexesSlow (const idx_t sample_chunk_offset, const idx_t chunk_length)
 
SelectionVectorHelper GetReplacementIndexesFast (const idx_t sample_chunk_offset, const idx_t chunk_length)
 
void SimpleMerge (ReservoirSample &other)
 
void WeightedMerge (ReservoirSample &other_sample)
 
unique_ptr< ReservoirChunkCreateNewSampleChunk (vector< LogicalType > &types, idx_t size) const
 
vector< uint32_tGetRandomizedVector (uint32_t range, uint32_t size) const
 

Private Attributes

idx_t sample_count
 
Allocatorallocator
 
unique_ptr< ReservoirChunkreservoir_chunk
 
bool stats_sample
 
SelectionVector sel
 
idx_t sel_size
 

Additional Inherited Members

- Public Attributes inherited from duckdb::BlockingSample
unique_ptr< BaseReservoirSamplingbase_reservoir_sample
 
SampleType type
 The sample type.
 
bool destroyed
 has the sample been destroyed due to updates to the referenced table
 

Member Function Documentation

◆ Vacuum()

void duckdb::ReservoirSample::Vacuum ( )

Vacuum the Reservoir Sample so it throws away tuples that are not in the reservoir weights or in the selection vector

◆ Copy()

unique_ptr< BlockingSample > duckdb::ReservoirSample::Copy ( ) const
overridevirtual

If for_serialization=true then the sample_chunk is not padded with extra spaces for future sampling values

Implements duckdb::BlockingSample.

◆ AddToReservoir()

void duckdb::ReservoirSample::AddToReservoir ( DataChunk input)
overridevirtual

Add a chunk of data to the sample.

Implements duckdb::BlockingSample.

◆ UpdateSampleAppend()

void duckdb::ReservoirSample::UpdateSampleAppend ( DataChunk this_,
DataChunk other,
SelectionVector other_sel,
idx_t  append_count 
) const

Update the sample by pushing new sample rows to the end of the sample_chunk. The new sample rows are the tuples rows resulting from applying sel to other

◆ GetChunk()

unique_ptr< DataChunk > duckdb::ReservoirSample::GetChunk ( )
overridevirtual

Fetches a chunk from the sample. Note that this method is destructive and should only be used after the sample is completely built.

Implements duckdb::BlockingSample.

◆ Destroy()

void duckdb::ReservoirSample::Destroy ( )
overridevirtual

Reimplemented from duckdb::BlockingSample.

◆ Finalize()

void duckdb::ReservoirSample::Finalize ( )
overridevirtual

◆ Serialize()

void duckdb::ReservoirSample::Serialize ( Serializer serializer) const
overridevirtual

Reimplemented from duckdb::BlockingSample.


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