Skip to content

Commit c842ae7

Browse files
committed
merge with v1.2.1
1 parent 173b746 commit c842ae7

File tree

9 files changed

+52
-56
lines changed

9 files changed

+52
-56
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PROJ_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
22

33
# Configuration of extension
4-
EXT_NAME=excel
4+
EXT_NAME=spatial
55
EXT_CONFIG=${PROJ_DIR}extension_config.cmake
66

77
# Include the Makefile from extension-ci-tools

duckdb

Submodule duckdb updated 1339 files

src/spatial/index/rtree/rtree_index.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class RTreeIndex final : public BoundIndex {
3434
return std::move(res);
3535
}
3636

37-
static unique_ptr<PhysicalOperator> CreatePlan(PlanIndexInput &input);
37+
static PhysicalOperator &CreatePlan(PlanIndexInput &input);
3838

3939
public:
4040
//! Called when data is appended to the index. The lock obtained from InitializeLock must be held

src/spatial/index/rtree/rtree_index_create_logical.cpp

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ void LogicalCreateRTreeIndex::ResolveColumnBindings(ColumnBindingResolver &res,
3939
[&](unique_ptr<Expression> *child) { res.VisitExpression(child); });
4040
}
4141

42-
static unique_ptr<PhysicalOperator> CreateNullFilter(const LogicalOperator &op, const vector<LogicalType> &types,
43-
ClientContext &context) {
42+
static PhysicalOperator &CreateNullFilter(PhysicalPlanGenerator &generator, const LogicalOperator &op,
43+
const vector<LogicalType> &types, ClientContext &context) {
4444
vector<unique_ptr<Expression>> filter_select_list;
4545

4646
// Filter NOT NULL on the GEOMETRY column
@@ -66,14 +66,13 @@ static unique_ptr<PhysicalOperator> CreateNullFilter(const LogicalOperator &op,
6666
// Combine into an AND
6767
auto and_expr = make_uniq_base<Expression, BoundConjunctionExpression>(
6868
ExpressionType::CONJUNCTION_AND, std::move(is_not_null_expr), std::move(is_not_empty_expr));
69-
7069
filter_select_list.push_back(std::move(and_expr));
7170

72-
return make_uniq<PhysicalFilter>(types, std::move(filter_select_list), op.estimated_cardinality);
71+
return generator.Make<PhysicalFilter>(types, std::move(filter_select_list), op.estimated_cardinality);
7372
}
7473

75-
static unique_ptr<PhysicalOperator>
76-
CreateBoundingBoxProjection(const LogicalOperator &op, const vector<LogicalType> &types, ClientContext &context) {
74+
static PhysicalOperator &CreateBoundingBoxProjection(PhysicalPlanGenerator &planner, const LogicalOperator &op,
75+
const vector<LogicalType> &types, ClientContext &context) {
7776
auto &catalog = Catalog::GetSystemCatalog(context);
7877

7978
// Get the bounding box function
@@ -96,11 +95,11 @@ CreateBoundingBoxProjection(const LogicalOperator &op, const vector<LogicalType>
9695
select_list.push_back(std::move(bbox_expr));
9796
select_list.push_back(std::move(rowid_expr));
9897

99-
return make_uniq<PhysicalProjection>(types, std::move(select_list), op.estimated_cardinality);
98+
return planner.Make<PhysicalProjection>(types, std::move(select_list), op.estimated_cardinality);
10099
}
101100

102-
static unique_ptr<PhysicalOperator> CreateOrderByMinX(const LogicalOperator &op, const vector<LogicalType> &types,
103-
ClientContext &context) {
101+
static PhysicalOperator &CreateOrderByMinX(PhysicalPlanGenerator &planner, const LogicalOperator &op,
102+
const vector<LogicalType> &types, ClientContext &context) {
104103
auto &catalog = Catalog::GetSystemCatalog(context);
105104

106105
// Get the centroid value function
@@ -130,14 +129,15 @@ static unique_ptr<PhysicalOperator> CreateOrderByMinX(const LogicalOperator &op,
130129
vector<BoundOrderByNode> orders;
131130
orders.emplace_back(OrderType::ASCENDING, OrderByNullType::NULLS_FIRST, std::move(xmin_expr));
132131
vector<idx_t> projections = {0, 1};
133-
return make_uniq<PhysicalOrder>(types, std::move(orders), projections, op.estimated_cardinality);
132+
return planner.Make<PhysicalOrder>(types, std::move(orders), projections, op.estimated_cardinality);
134133
}
135134

136-
unique_ptr<PhysicalOperator> RTreeIndex::CreatePlan(PlanIndexInput &input) {
135+
PhysicalOperator &RTreeIndex::CreatePlan(PlanIndexInput &input) {
137136

138137
auto &op = input.op;
139138
auto &table_scan = input.table_scan;
140139
auto &context = input.context;
140+
auto &planner = input.planner;
141141

142142
// generate a physical plan for the parallel index creation which consists of the following operators
143143
// table scan - projection (for expression execution) - filter (NOT NULL) - order - create index
@@ -175,38 +175,35 @@ unique_ptr<PhysicalOperator> RTreeIndex::CreatePlan(PlanIndexInput &input) {
175175
select_list.push_back(make_uniq<BoundReferenceExpression>(LogicalType::ROW_TYPE, op.info->scan_types.size() - 1));
176176

177177
// Project the expressions
178-
auto projection = make_uniq<PhysicalProjection>(new_column_types, std::move(select_list), op.estimated_cardinality);
179-
projection->children.push_back(std::move(table_scan));
178+
auto &projection =
179+
planner.Make<PhysicalProjection>(new_column_types, std::move(select_list), op.estimated_cardinality);
180+
projection.children.push_back(table_scan);
180181

181182
// Filter operator for (IS_NOT_NULL) and (NOT ST_IsEmpty) on the geometry column
182-
auto null_filter = CreateNullFilter(op, new_column_types, context);
183-
null_filter->children.push_back(std::move(projection));
183+
auto &null_filter = CreateNullFilter(planner, op, new_column_types, context);
184+
null_filter.children.push_back(projection);
184185

185186
// Project the bounding box and the row ID
186187
vector<LogicalType> projected_types = {GeoTypes::BOX_2DF(), LogicalType::ROW_TYPE};
187-
auto bbox_proj = CreateBoundingBoxProjection(op, projected_types, context);
188-
bbox_proj->children.push_back(std::move(null_filter));
188+
auto &bbox_proj = CreateBoundingBoxProjection(planner, op, projected_types, context);
189+
bbox_proj.children.push_back(null_filter);
189190

190191
// Create an ORDER_BY operator to sort the bounding boxes by the xmin value
191-
auto physical_order = CreateOrderByMinX(op, projected_types, context);
192-
physical_order->children.push_back(std::move(bbox_proj));
192+
auto &physical_order = CreateOrderByMinX(planner, op, projected_types, context);
193+
physical_order.children.push_back(bbox_proj);
193194

194195
// Now finally create the actual physical create index operator
195-
auto physical_create_index =
196-
make_uniq<PhysicalCreateRTreeIndex>(op, op.table, op.info->column_ids, std::move(op.info),
197-
std::move(op.unbound_expressions), op.estimated_cardinality);
198-
199-
physical_create_index->children.push_back(std::move(physical_order));
200-
201-
return std::move(physical_create_index);
196+
auto &physical_create_index =
197+
planner.Make<PhysicalCreateRTreeIndex>(op, op.table, op.info->column_ids, std::move(op.info),
198+
std::move(op.unbound_expressions), op.estimated_cardinality);
199+
physical_create_index.children.push_back(physical_order);
200+
return physical_create_index;
202201
}
203202

204203
// TODO: Remove this
205-
unique_ptr<PhysicalOperator> LogicalCreateRTreeIndex::CreatePlan(ClientContext &context,
206-
PhysicalPlanGenerator &generator) {
207-
208-
auto table_scan = generator.CreatePlan(std::move(children[0]));
204+
PhysicalOperator &LogicalCreateRTreeIndex::CreatePlan(ClientContext &context, PhysicalPlanGenerator &planner) {
209205

206+
auto &table_scan = planner.CreatePlan(*children[0]);
210207
auto &op = *this;
211208

212209
// generate a physical plan for the parallel index creation which consists of the following operators
@@ -235,7 +232,7 @@ unique_ptr<PhysicalOperator> LogicalCreateRTreeIndex::CreatePlan(ClientContext &
235232
D_ASSERT(op.info->index_type == RTreeIndex::TYPE_NAME);
236233

237234
// table scan operator for index key columns and row IDs
238-
generator.dependencies.AddDependency(op.table);
235+
planner.dependencies.AddDependency(op.table);
239236

240237
D_ASSERT(op.info->scan_types.size() - 1 <= op.info->names.size());
241238
D_ASSERT(op.info->scan_types.size() - 1 <= op.info->column_ids.size());
@@ -255,30 +252,29 @@ unique_ptr<PhysicalOperator> LogicalCreateRTreeIndex::CreatePlan(ClientContext &
255252
select_list.push_back(make_uniq<BoundReferenceExpression>(LogicalType::ROW_TYPE, op.info->scan_types.size() - 1));
256253

257254
// Project the expressions
258-
auto projection = make_uniq<PhysicalProjection>(new_column_types, std::move(select_list), op.estimated_cardinality);
259-
projection->children.push_back(std::move(table_scan));
255+
auto &projection =
256+
planner.Make<PhysicalProjection>(new_column_types, std::move(select_list), op.estimated_cardinality);
257+
projection.children.push_back(table_scan);
260258

261259
// Filter operator for (IS_NOT_NULL) and (NOT ST_IsEmpty) on the geometry column
262-
auto null_filter = CreateNullFilter(op, new_column_types, context);
263-
null_filter->children.push_back(std::move(projection));
260+
auto &null_filter = CreateNullFilter(planner, op, new_column_types, context);
261+
null_filter.children.push_back(projection);
264262

265263
// Project the bounding box and the row ID
266264
vector<LogicalType> projected_types = {GeoTypes::BOX_2DF(), LogicalType::ROW_TYPE};
267-
auto bbox_proj = CreateBoundingBoxProjection(op, projected_types, context);
268-
bbox_proj->children.push_back(std::move(null_filter));
265+
auto &bbox_proj = CreateBoundingBoxProjection(planner, op, projected_types, context);
266+
bbox_proj.children.push_back(null_filter);
269267

270268
// Create an ORDER_BY operator to sort the bounding boxes by the xmin value
271-
auto physical_order = CreateOrderByMinX(op, projected_types, context);
272-
physical_order->children.push_back(std::move(bbox_proj));
269+
auto &physical_order = CreateOrderByMinX(planner, op, projected_types, context);
270+
physical_order.children.push_back(bbox_proj);
273271

274272
// Now finally create the actual physical create index operator
275-
auto physical_create_index =
276-
make_uniq<PhysicalCreateRTreeIndex>(op, op.table, op.info->column_ids, std::move(op.info),
277-
std::move(op.unbound_expressions), op.estimated_cardinality);
278-
279-
physical_create_index->children.push_back(std::move(physical_order));
280-
281-
return std::move(physical_create_index);
273+
auto &physical_create_index =
274+
planner.Make<PhysicalCreateRTreeIndex>(op, op.table, op.info->column_ids, std::move(op.info),
275+
std::move(op.unbound_expressions), op.estimated_cardinality);
276+
physical_create_index.children.push_back(physical_order);
277+
return physical_create_index;
282278
}
283279

284280
} // namespace duckdb

src/spatial/index/rtree/rtree_index_create_logical.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LogicalCreateRTreeIndex final : public LogicalExtensionOperator {
2525
void ResolveColumnBindings(ColumnBindingResolver &res, vector<ColumnBinding> &bindings) override;
2626

2727
// Actually create and plan the index creation
28-
unique_ptr<PhysicalOperator> CreatePlan(ClientContext &context, PhysicalPlanGenerator &generator) override;
28+
PhysicalOperator &CreatePlan(ClientContext &context, PhysicalPlanGenerator &planner) override;
2929

3030
void Serialize(Serializer &writer) const override {
3131
LogicalExtensionOperator::Serialize(writer);

src/spatial/index/rtree/rtree_index_scan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static unique_ptr<GlobalTableFunctionState> RTreeIndexScanInitGlobal(ClientConte
6060
}
6161

6262
// Initialize the storage scan state
63-
result->local_storage_state.Initialize(result->column_ids, input.filters.get());
63+
result->local_storage_state.Initialize(result->column_ids, context, input.filters);
6464
local_storage.InitializeScan(bind_data.table.GetStorage(), result->local_storage_state.local_state, input.filters);
6565

6666
// Initialize the scan state for the index

src/spatial/modules/gdal/gdal_module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// DuckDB
1111
#include "duckdb/main/database.hpp"
1212
#include "duckdb/common/enums/file_glob_options.hpp"
13-
#include "duckdb/common/multi_file_reader.hpp"
13+
#include "duckdb/common/multi_file/multi_file_reader.hpp"
1414
#include "duckdb/function/table/arrow.hpp"
1515
#include "duckdb/main/extension_util.hpp"
1616
#include "duckdb/parser/parsed_data/create_table_function_info.hpp"

src/spatial/modules/shapefile/shapefile_module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "spatial/geometry/sgl.hpp"
44
#include "spatial/spatial_types.hpp"
55

6-
#include "duckdb/common/multi_file_reader.hpp"
6+
#include "duckdb/common/multi_file/multi_file_reader.hpp"
77
#include "duckdb/function/replacement_scan.hpp"
88
#include "duckdb/main/extension_util.hpp"
99
#include "duckdb/parser/expression/constant_expression.hpp"

test/sql/geometry/st_dump.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SElECT ST_Dump(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY'));
2525
query I
2626
SElECT ST_Dump(ST_GeomFromText('GEOMETRYCOLLECTION (POINT (0 0))'));
2727
----
28-
[{'geom': POINT (0 0), 'path': [1]}]
28+
[{'geom': 'POINT (0 0)', 'path': [1]}]
2929

3030
# Test with multipoint
3131
query II
@@ -69,9 +69,9 @@ FROM (VALUES
6969
(ST_GeomFromText('GEOMETRYCOLLECTION (POINT (1 1), GEOMETRYCOLLECTION(POINT (3 3)), POINT (2 2))'))
7070
) as t(geom)
7171
----
72-
[{'geom': POINT (1 1), 'path': [1]}, {'geom': POINT (2 2), 'path': [2]}, {'geom': POINT (3 3), 'path': [3, 1]}]
72+
[{'geom': 'POINT (1 1)', 'path': [1]}, {'geom': 'POINT (2 2)', 'path': [2]}, {'geom': 'POINT (3 3)', 'path': [3, 1]}]
7373
NULL
74-
[{'geom': POINT (1 1), 'path': [1]}, {'geom': POINT (3 3), 'path': [2, 1]}, {'geom': POINT (2 2), 'path': [3]}]
74+
[{'geom': 'POINT (1 1)', 'path': [1]}, {'geom': 'POINT (3 3)', 'path': [2, 1]}, {'geom': 'POINT (2 2)', 'path': [3]}]
7575

7676

7777
# With Z and M

0 commit comments

Comments
 (0)