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

RadixPartitionedColumnData is a PartitionedColumnData that partitions input based on the radix of a hash. More...

Inheritance diagram for duckdb::RadixPartitionedColumnData:
Collaboration diagram for duckdb::RadixPartitionedColumnData:

Public Member Functions

 RadixPartitionedColumnData (ClientContext &context, vector< LogicalType > types, idx_t radix_bits, idx_t hash_col_idx)
 RadixPartitionedColumnData (const RadixPartitionedColumnData &other)
idx_t GetRadixBits () const
Public Member Functions inherited from duckdb::PartitionedColumnData
unique_ptr< PartitionedColumnData > CreateShared ()
void InitializeAppendState (PartitionedColumnDataAppendState &state) const
 Initializes a local state for parallel partitioning that can be merged into this PartitionedColumnData.
void Append (PartitionedColumnDataAppendState &state, DataChunk &input)
 Appends a DataChunk to this PartitionedColumnData.
void FlushAppendState (PartitionedColumnDataAppendState &state)
 Flushes any remaining data in the append state into this PartitionedColumnData.
void Combine (PartitionedColumnData &other)
 Combine another PartitionedColumnData into this PartitionedColumnData.
vector< unique_ptr< ColumnDataCollection > > & GetPartitions ()
 Get the partitions in this PartitionedColumnData.
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Protected Member Functions

idx_t BufferSize () const override
 Size of the buffers in the append states for this type of partitioning (default 128).
void InitializeAppendStateInternal (PartitionedColumnDataAppendState &state) const override
 Initialize a PartitionedColumnDataAppendState for this type of partitioning (optional).
void ComputePartitionIndices (PartitionedColumnDataAppendState &state, DataChunk &input) override
 Compute the partition indices for this type of partitioning for the input DataChunk and store them in the partition_data of the local state. If this type creates partitions on the fly (for, e.g., hive), this function is also in charge of creating new partitions and mapping the input data to a partition index.
idx_t MaxPartitionIndex () const override
 Maximum partition index (optional).
Protected Member Functions inherited from duckdb::PartitionedColumnData
 PartitionedColumnData (PartitionedColumnDataType type, ClientContext &context, vector< LogicalType > types)
 PartitionedColumnData can only be instantiated by derived classes.
 PartitionedColumnData (const PartitionedColumnData &other)
idx_t HalfBufferSize () const
 If the buffer is half full, we append to the partition.
void CreateAllocator ()
 Create a new shared allocator.
bool UseFixedSizeMap () const
 Whether to use fixed size map or regular map.
void BuildPartitionSel (PartitionedColumnDataAppendState &state, const idx_t append_count) const
 Builds a selection vector in the Append state for the partitions.
template<bool fixed>
void AppendInternal (PartitionedColumnDataAppendState &state, DataChunk &input)
 Appends a DataChunk to this PartitionedColumnData.
unique_ptr< ColumnDataCollection > CreatePartitionCollection (idx_t partition_index) const
 Create a collection for a specific a partition.
unique_ptr< DataChunk > CreatePartitionBuffer () const
 Create a DataChunk used for buffering appends to the partition.

Static Protected Member Functions

static constexpr idx_t GetBufferSize (idx_t div)
Static Protected Member Functions inherited from duckdb::PartitionedColumnData
template<bool fixed>
static void BuildPartitionSel (PartitionedColumnDataAppendState &state, const idx_t append_count)

Private Attributes

const idx_t radix_bits
 The number of radix bits.
const idx_t hash_col_idx
 The index of the column holding the hashes.

Additional Inherited Members

Protected Attributes inherited from duckdb::PartitionedColumnData
PartitionedColumnDataType type
ClientContext & context
vector< LogicalType > types
mutex lock
shared_ptr< PartitionColumnDataAllocators > allocators
vector< unique_ptr< ColumnDataCollection > > partitions

Detailed Description

RadixPartitionedColumnData is a PartitionedColumnData that partitions input based on the radix of a hash.

Constructor & Destructor Documentation

◆ RadixPartitionedColumnData() [1/2]

duckdb::RadixPartitionedColumnData::RadixPartitionedColumnData ( ClientContext & context,
vector< LogicalType > types,
idx_t radix_bits,
idx_t hash_col_idx )
93668 : PartitionedColumnData(PartitionedColumnDataType::RADIX, context_p, std::move(types_p)), radix_bits(radix_bits_p),
93669 hash_col_idx(hash_col_idx_p) {
93671 D_ASSERT(hash_col_idx < types.size());
93672 const auto num_partitions = RadixPartitioning::NumberOfPartitions(radix_bits);
93673 allocators->allocators.reserve(num_partitions);
93674 for (idx_t i = 0; i < num_partitions; i++) {
93676 allocators->allocators.back()->SetPartitionIndex(i);
93677 }
93678 D_ASSERT(allocators->allocators.size() == num_partitions);
93679}
void CreateAllocator()
Create a new shared allocator.
Definition duckdb.cpp:116586
PartitionedColumnData(PartitionedColumnDataType type, ClientContext &context, vector< LogicalType > types)
PartitionedColumnData can only be instantiated by derived classes.
Definition duckdb.cpp:116371
const idx_t hash_col_idx
The index of the column holding the hashes.
Definition duckdb.cpp:93500
const idx_t radix_bits
The number of radix bits.
Definition duckdb.cpp:93498
@ RADIX
Radix partitioning on a hash column.
Definition duckdb.hpp:47014
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
static constexpr const idx_t MAX_RADIX_BITS
4096 partitions ought to be enough to go out-of-core properly
Definition duckdb.cpp:93422
static constexpr idx_t NumberOfPartitions(idx_t radix_bits)
The number of partitions for a given number of radix bits.
Definition duckdb.cpp:93425

◆ RadixPartitionedColumnData() [2/2]

duckdb::RadixPartitionedColumnData::RadixPartitionedColumnData ( const RadixPartitionedColumnData & other)
93682 : PartitionedColumnData(other), radix_bits(other.radix_bits), hash_col_idx(other.hash_col_idx) {
93684 partitions.emplace_back(CreatePartitionCollection(i));
93685 }
93686}
unique_ptr< ColumnDataCollection > CreatePartitionCollection(idx_t partition_index) const
Create a collection for a specific a partition.
Definition duckdb.hpp:47091

◆ ~RadixPartitionedColumnData()

duckdb::RadixPartitionedColumnData::~RadixPartitionedColumnData ( )
override
93688 {
93689}

Member Function Documentation

◆ GetRadixBits()

idx_t duckdb::RadixPartitionedColumnData::GetRadixBits ( ) const
inline
93462 {
93463 return radix_bits;
93464 }

◆ BufferSize()

idx_t duckdb::RadixPartitionedColumnData::BufferSize ( ) const
inlineoverrideprotectedvirtual

Size of the buffers in the append states for this type of partitioning (default 128).

Reimplemented from duckdb::PartitionedColumnData.

93470 {
93471 switch (radix_bits) {
93472 case 1:
93473 case 2:
93474 case 3:
93475 case 4:
93476 return GetBufferSize(1 << 1);
93477 case 5:
93478 return GetBufferSize(1 << 2);
93479 case 6:
93480 return GetBufferSize(1 << 3);
93481 default:
93482 return GetBufferSize(1 << 4);
93483 }
93484 }

◆ InitializeAppendStateInternal()

void duckdb::RadixPartitionedColumnData::InitializeAppendStateInternal ( PartitionedColumnDataAppendState & state) const
overrideprotectedvirtual

Initialize a PartitionedColumnDataAppendState for this type of partitioning (optional).

Reimplemented from duckdb::PartitionedColumnData.

93691 {
93692 const auto num_partitions = RadixPartitioning::NumberOfPartitions(radix_bits);
93693 state.partition_append_states.reserve(num_partitions);
93694 state.partition_buffers.reserve(num_partitions);
93695 for (idx_t i = 0; i < num_partitions; i++) {
93696 state.partition_append_states.emplace_back(make_uniq<ColumnDataAppendState>());
93697 partitions[i]->InitializeAppend(*state.partition_append_states[i]);
93698 state.partition_buffers.emplace_back(CreatePartitionBuffer());
93699 }
93700
93701 // Initialize fixed-size map
93702 state.fixed_partition_entries.resize(RadixPartitioning::NumberOfPartitions(radix_bits));
93703}
unique_ptr< DataChunk > CreatePartitionBuffer() const
Create a DataChunk used for buffering appends to the partition.
Definition duckdb.cpp:116403
Here is the call graph for this function:

◆ ComputePartitionIndices()

void duckdb::RadixPartitionedColumnData::ComputePartitionIndices ( PartitionedColumnDataAppendState & state,
DataChunk & input )
overrideprotectedvirtual

Compute the partition indices for this type of partitioning for the input DataChunk and store them in the partition_data of the local state. If this type creates partitions on the fly (for, e.g., hive), this function is also in charge of creating new partitions and mapping the input data to a partition index.

Reimplemented from duckdb::PartitionedColumnData.

93705 {
93706 D_ASSERT(partitions.size() == RadixPartitioning::NumberOfPartitions(radix_bits));
93707 D_ASSERT(state.partition_buffers.size() == RadixPartitioning::NumberOfPartitions(radix_bits));
93708 RadixBitsSwitch<ComputePartitionIndicesFunctor, void>(radix_bits, input.data[hash_col_idx], state.partition_indices,
93709 input.size(), *FlatVector::IncrementalSelectionVector(),
93710 input.size());
93711}
vector< Vector > data
The vectors owned by the DataChunk.
Definition duckdb.hpp:11445
Here is the call graph for this function:

◆ MaxPartitionIndex()

idx_t duckdb::RadixPartitionedColumnData::MaxPartitionIndex ( ) const
inlineoverrideprotectedvirtual

Maximum partition index (optional).

Reimplemented from duckdb::PartitionedColumnData.

93488 {
93490 }
Here is the call graph for this function:

◆ GetBufferSize()

constexpr idx_t duckdb::RadixPartitionedColumnData::GetBufferSize ( idx_t div)
inlinestaticconstexprprotected
93492 {
93493 return STANDARD_VECTOR_SIZE / div == 0 ? 1 : STANDARD_VECTOR_SIZE / div;
93494 }
GMat div(const GMat &src1, const GMat &src2, double scale, int ddepth=-1)

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