forked from duckdb/duckdb-spatial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspatial_join_physical.hpp
More file actions
94 lines (73 loc) · 3.46 KB
/
Copy pathspatial_join_physical.hpp
File metadata and controls
94 lines (73 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#pragma once
#include "duckdb/execution/operator/join/physical_join.hpp"
#include "duckdb/planner/operator/logical_join.hpp"
#include "duckdb/common/types/row/tuple_data_layout.hpp"
namespace duckdb {
class PhysicalSpatialJoin final : public PhysicalJoin {
public:
static constexpr auto TYPE = PhysicalOperatorType::EXTENSION;
public:
PhysicalSpatialJoin(LogicalOperator &op, PhysicalOperator &left, PhysicalOperator &right,
unique_ptr<Expression> spatial_predicate, JoinType join_type, idx_t estimated_cardinality,
bool has_const_distance, double const_distance);
//! The condition of the join
unique_ptr<Expression> condition;
optional_ptr<Expression> build_side_key;
optional_ptr<Expression> probe_side_key;
vector<column_t> build_side_output_columns;
vector<column_t> probe_side_output_columns;
vector<column_t> build_side_payload_columns;
vector<LogicalType> probe_side_output_types;
vector<LogicalType> build_side_output_types;
vector<LogicalType> build_side_payload_types;
vector<LogicalType> build_side_key_types;
shared_ptr<TupleDataLayout> layout;
idx_t build_side_match_offset = 0; // This is the byte offset to the match column for right/outer joins
// In case this is a ST_DWithin join, we store the constant distance here
bool has_const_distance = false;
double const_distance = 0.0;
public:
// Operator Interface
unique_ptr<OperatorState> GetOperatorState(ExecutionContext &context) const override;
unique_ptr<GlobalOperatorState> GetGlobalOperatorState(ClientContext &context) const override;
bool ParallelOperator() const override {
return true;
}
protected:
// CachingOperatorState Interface
OperatorResultType ExecuteInternal(ExecutionContext &context, DataChunk &input, DataChunk &chunk,
GlobalOperatorState &gstate, OperatorState &state) const override;
public:
// Sink interface
unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
unique_ptr<LocalSinkState> GetLocalSinkState(ExecutionContext &context) const override;
SinkResultType Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const override;
SinkCombineResultType Combine(ExecutionContext &context, OperatorSinkCombineInput &input) const override;
SinkFinalizeType Finalize(Pipeline &pipeline, Event &event, ClientContext &context,
OperatorSinkFinalizeInput &input) const override;
bool IsSink() const override {
return true;
}
bool ParallelSink() const override {
return true;
}
public:
// Source interface
unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
unique_ptr<LocalSourceState> GetLocalSourceState(ExecutionContext &context,
GlobalSourceState &gstate) const override;
SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override;
bool IsSource() const override {
// The PhysicalSpatialJoin is only a source if the join type is RIGHT/OUTER
return PropagatesBuildSide(join_type);
}
bool ParallelSource() const override {
return true;
}
public:
//! Returns the current progress percentage, or a negative value if progress bars are not supported
ProgressData GetProgress(ClientContext &context, GlobalSourceState &gstate) const override;
InsertionOrderPreservingMap<string> ParamsToString() const override;
string GetName() const override;
};
} // namespace duckdb