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

Public Types

using LocalSortedTable = PhysicalRangeJoin::LocalSortedTable
using GlobalSortedTable = PhysicalRangeJoin::GlobalSortedTable

Public Member Functions

 PiecewiseMergeJoinState (ClientContext &client, const PhysicalPiecewiseMergeJoin &op)
void ResolveJoinKeys (ExecutionContext &context, DataChunk &input)
Public Member Functions inherited from duckdb::CachingOperatorState
void Finalize (const PhysicalOperator &op, ExecutionContext &context) override
Public Member Functions inherited from duckdb::OperatorState
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Public Attributes

ClientContext & client
Allocator & allocator
const PhysicalPiecewiseMergeJoin & op
DataChunk lhs_payload
OuterJoinMarker left_outer
vector< BoundOrderByNode > lhs_order
unique_ptr< GlobalSortedTable > lhs_global_table
unique_ptr< LocalSortedTable > lhs_local_table
SortKeyType sort_key_type
TupleDataScanState lhs_scan
idx_t left_position
bool first_fetch
bool finished
unique_ptr< ExternalBlockIteratorState > lhs_iterator
unique_ptr< ExternalBlockIteratorState > rhs_iterator
idx_t right_position
idx_t right_chunk_index
idx_t right_base
idx_t prev_left_index
TupleDataChunkState rhs_chunk_state
unique_ptr< SortedRunScanState > rhs_scan_state
SelectionVector sel
DataChunk rhs_keys
DataChunk rhs_input
ExpressionExecutor rhs_executor
Public Attributes inherited from duckdb::CachingOperatorState
unique_ptr< DataChunk > cached_chunk
bool initialized = false
OperatorCachingMode can_cache_chunk = OperatorCachingMode::NONE
 Whether or not the chunk can be cached.
bool must_return_continuation_chunk = false
OperatorResultType cached_result

Constructor & Destructor Documentation

◆ PiecewiseMergeJoinState()

duckdb::PiecewiseMergeJoinState::PiecewiseMergeJoinState ( ClientContext & client,
const PhysicalPiecewiseMergeJoin & op )
inline
188942 : client(client), allocator(Allocator::Get(client)), op(op), left_outer(IsLeftOuterJoin(op.join_type)),
188943 left_position(0), first_fetch(true), finished(true), right_position(0), right_chunk_index(0),
188944 rhs_executor(client) {
188945 left_outer.Initialize(STANDARD_VECTOR_SIZE);
188946 lhs_payload.Initialize(client, op.children[0].get().GetTypes());
188947
188948 // Sort on the first column
188949 lhs_order.emplace_back(op.lhs_orders[0].Copy());
188950
188951 // Set up shared data for multiple predicates
188952 sel.Initialize(STANDARD_VECTOR_SIZE);
188953 vector<LogicalType> condition_types;
188954 for (auto &order : op.rhs_orders) {
188955 rhs_executor.AddExpression(*order.expression);
188956 condition_types.push_back(order.expression->return_type);
188957 }
188958 rhs_keys.Initialize(client, condition_types);
188959 rhs_input.Initialize(client, op.children[1].get().GetTypes());
188960
188961 auto &gsink = op.sink_state->Cast<MergeJoinGlobalState>();
188962 auto &rhs_table = *gsink.table;
188963 rhs_iterator = rhs_table.CreateIteratorState();
188964 rhs_table.InitializePayloadState(rhs_chunk_state);
188965 rhs_scan_state = rhs_table.CreateScanState(client);
188966
188967 // Since we have now materialized the payload, the keys will not have payloads?
188968 sort_key_type = rhs_table.GetSortKeyType();
188969 }
bool IsLeftOuterJoin(JoinType type)
True if join is left or full outer join.
Definition duckdb.cpp:68419

Member Function Documentation

◆ ResolveJoinKeys()

void duckdb::PiecewiseMergeJoinState::ResolveJoinKeys ( ExecutionContext & context,
DataChunk & input )
inline
189006 {
189007 // sort by join key
189008 const auto &lhs_types = lhs_payload.GetTypes();
189009 lhs_global_table = make_uniq<GlobalSortedTable>(context.client, lhs_order, lhs_types, op);
189010 lhs_local_table = make_uniq<LocalSortedTable>(context, *lhs_global_table, 0U);
189011 lhs_local_table->Sink(context, input);
189012 lhs_global_table->Combine(context, *lhs_local_table);
189013
189014 InterruptState interrupt;
189015 lhs_global_table->Finalize(context.client, interrupt);
189016 lhs_global_table->Materialize(context, interrupt);
189017
189018 // Scan the sorted payload (minus the primary sort column)
189019 auto &lhs_table = *lhs_global_table;
189020 auto &lhs_payload_data = *lhs_table.sorted->payload_data;
189021 lhs_payload_data.InitializeScan(lhs_scan);
189022 lhs_payload_data.Scan(lhs_scan, lhs_payload);
189023
189024 // Recompute the sorted keys from the sorted input
189025 auto &lhs_keys = lhs_local_table->keys;
189026 lhs_keys.Reset();
189027 lhs_local_table->executor.Execute(lhs_payload, lhs_keys);
189028
189029 lhs_iterator = lhs_table.CreateIteratorState();
189030 }

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