duckdb 0.7.2-dev1901.0 → 0.7.2-dev2233.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +2 -0
- package/package.json +1 -1
- package/src/duckdb/extension/parquet/column_reader.cpp +3 -0
- package/src/duckdb/extension/parquet/include/parquet_writer.hpp +1 -1
- package/src/duckdb/extension/parquet/parquet_metadata.cpp +4 -2
- package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +1 -1
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +69 -44
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +1 -1
- package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +20 -2
- package/src/duckdb/src/common/box_renderer.cpp +4 -2
- package/src/duckdb/src/common/constants.cpp +10 -1
- package/src/duckdb/src/common/filename_pattern.cpp +41 -0
- package/src/duckdb/src/common/hive_partitioning.cpp +144 -15
- package/src/duckdb/src/common/radix_partitioning.cpp +101 -369
- package/src/duckdb/src/common/row_operations/row_aggregate.cpp +8 -9
- package/src/duckdb/src/common/row_operations/row_external.cpp +1 -1
- package/src/duckdb/src/common/row_operations/row_gather.cpp +5 -3
- package/src/duckdb/src/common/row_operations/row_match.cpp +117 -22
- package/src/duckdb/src/common/row_operations/row_scatter.cpp +2 -2
- package/src/duckdb/src/common/sort/partition_state.cpp +1 -1
- package/src/duckdb/src/common/sort/sort_state.cpp +2 -1
- package/src/duckdb/src/common/sort/sorted_block.cpp +1 -1
- package/src/duckdb/src/common/types/{column_data_allocator.cpp → column/column_data_allocator.cpp} +2 -2
- package/src/duckdb/src/common/types/{column_data_collection.cpp → column/column_data_collection.cpp} +29 -6
- package/src/duckdb/src/common/types/{column_data_collection_segment.cpp → column/column_data_collection_segment.cpp} +2 -1
- package/src/duckdb/src/common/types/{column_data_consumer.cpp → column/column_data_consumer.cpp} +1 -1
- package/src/duckdb/src/common/types/{partitioned_column_data.cpp → column/partitioned_column_data.cpp} +11 -9
- package/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +316 -0
- package/src/duckdb/src/common/types/{row_data_collection.cpp → row/row_data_collection.cpp} +1 -1
- package/src/duckdb/src/common/types/{row_data_collection_scanner.cpp → row/row_data_collection_scanner.cpp} +2 -2
- package/src/duckdb/src/common/types/{row_layout.cpp → row/row_layout.cpp} +1 -1
- package/src/duckdb/src/common/types/row/tuple_data_allocator.cpp +465 -0
- package/src/duckdb/src/common/types/row/tuple_data_collection.cpp +511 -0
- package/src/duckdb/src/common/types/row/tuple_data_iterator.cpp +96 -0
- package/src/duckdb/src/common/types/row/tuple_data_layout.cpp +119 -0
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +1200 -0
- package/src/duckdb/src/common/types/row/tuple_data_segment.cpp +170 -0
- package/src/duckdb/src/common/types/vector.cpp +1 -1
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +252 -290
- package/src/duckdb/src/execution/join_hashtable.cpp +192 -328
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +4 -4
- package/src/duckdb/src/execution/operator/helper/physical_execute.cpp +3 -3
- package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +2 -3
- package/src/duckdb/src/execution/operator/helper/physical_result_collector.cpp +2 -3
- package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +36 -21
- package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +2 -2
- package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +2 -2
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +166 -144
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +5 -5
- package/src/duckdb/src/execution/operator/join/physical_join.cpp +2 -10
- package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +0 -1
- package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +3 -0
- package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +71 -22
- package/src/duckdb/src/execution/operator/persistent/csv_buffer.cpp +17 -13
- package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +0 -7
- package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +124 -29
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +13 -11
- package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +3 -2
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +25 -24
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +4 -3
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +1 -1
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +3 -3
- package/src/duckdb/src/execution/partitionable_hashtable.cpp +9 -37
- package/src/duckdb/src/execution/physical_operator.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +19 -18
- package/src/duckdb/src/execution/physical_plan/plan_copy_to_file.cpp +2 -1
- package/src/duckdb/src/execution/physical_plan/plan_execute.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_explain.cpp +5 -6
- package/src/duckdb/src/execution/physical_plan/plan_expression_get.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp +3 -3
- package/src/duckdb/src/execution/physical_plan_generator.cpp +1 -1
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +39 -17
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +2 -2
- package/src/duckdb/src/function/table/pragma_detailed_profiling_output.cpp +5 -5
- package/src/duckdb/src/function/table/pragma_last_profiling_output.cpp +2 -2
- package/src/duckdb/src/function/table/read_csv.cpp +124 -58
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/arrow/arrow_appender.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/exception.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/fast_mem.hpp +528 -0
- package/src/duckdb/src/include/duckdb/common/filename_pattern.hpp +34 -0
- package/src/duckdb/src/include/duckdb/common/helper.hpp +10 -0
- package/src/duckdb/src/include/duckdb/common/hive_partitioning.hpp +13 -3
- package/src/duckdb/src/include/duckdb/common/optional_ptr.hpp +8 -0
- package/src/duckdb/src/include/duckdb/common/perfect_map_set.hpp +34 -0
- package/src/duckdb/src/include/duckdb/common/radix_partitioning.hpp +80 -27
- package/src/duckdb/src/include/duckdb/common/reference_map.hpp +38 -0
- package/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp +7 -6
- package/src/duckdb/src/include/duckdb/common/sort/comparators.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/sort/partition_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/sort/sort.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/sort/sorted_block.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/batched_data_collection.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/{column_data_allocator.hpp → column/column_data_allocator.hpp} +4 -4
- package/src/duckdb/src/include/duckdb/common/types/{column_data_collection.hpp → column/column_data_collection.hpp} +4 -4
- package/src/duckdb/src/include/duckdb/common/types/{column_data_collection_iterators.hpp → column/column_data_collection_iterators.hpp} +2 -2
- package/src/duckdb/src/include/duckdb/common/types/{column_data_collection_segment.hpp → column/column_data_collection_segment.hpp} +3 -3
- package/src/duckdb/src/include/duckdb/common/types/{column_data_consumer.hpp → column/column_data_consumer.hpp} +8 -4
- package/src/duckdb/src/include/duckdb/common/types/{column_data_scan_states.hpp → column/column_data_scan_states.hpp} +1 -1
- package/src/duckdb/src/include/duckdb/common/types/{partitioned_column_data.hpp → column/partitioned_column_data.hpp} +15 -7
- package/src/duckdb/src/include/duckdb/common/types/row/partitioned_tuple_data.hpp +140 -0
- package/src/duckdb/src/include/duckdb/common/types/{row_data_collection.hpp → row/row_data_collection.hpp} +1 -1
- package/src/duckdb/src/include/duckdb/common/types/{row_data_collection_scanner.hpp → row/row_data_collection_scanner.hpp} +2 -2
- package/src/duckdb/src/include/duckdb/common/types/{row_layout.hpp → row/row_layout.hpp} +3 -1
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_allocator.hpp +116 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_collection.hpp +239 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_iterator.hpp +64 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_layout.hpp +113 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_segment.hpp +124 -0
- package/src/duckdb/src/include/duckdb/common/types/row/tuple_data_states.hpp +74 -0
- package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +4 -12
- package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +34 -31
- package/src/duckdb/src/include/duckdb/execution/base_aggregate_hashtable.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/execution_context.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/expression_executor.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +41 -67
- package/src/duckdb/src/include/duckdb/execution/nested_loop_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_execute.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_result_collector.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/outer_join_marker.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/perfect_hash_join_executor.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +0 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_index_join.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/buffered_csv_reader.hpp +4 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_buffer.hpp +8 -3
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +5 -7
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/parallel_csv_reader.hpp +5 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +4 -1
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/partitionable_hashtable.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/function.hpp +2 -0
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +25 -0
- package/src/duckdb/src/include/duckdb/main/client_data.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/config.hpp +0 -2
- package/src/duckdb/src/include/duckdb/main/materialized_query_result.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +14 -1
- package/src/duckdb/src/include/duckdb/optimizer/expression_rewriter.hpp +3 -3
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +16 -16
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_node.hpp +8 -8
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_order_optimizer.hpp +23 -15
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_relation.hpp +9 -10
- package/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph.hpp +18 -11
- package/src/duckdb/src/include/duckdb/parallel/meta_pipeline.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +5 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/query_error_context.hpp +4 -2
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +9 -35
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +24 -23
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +3 -3
- package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +3 -1
- package/src/duckdb/src/include/duckdb/storage/table/table_index_list.hpp +1 -1
- package/src/duckdb/src/main/appender.cpp +6 -6
- package/src/duckdb/src/main/client_context.cpp +1 -1
- package/src/duckdb/src/main/connection.cpp +2 -2
- package/src/duckdb/src/main/query_result.cpp +13 -0
- package/src/duckdb/src/main/settings/settings.cpp +3 -4
- package/src/duckdb/src/optimizer/expression_rewriter.cpp +4 -4
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +91 -105
- package/src/duckdb/src/optimizer/join_order/join_node.cpp +5 -8
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +163 -160
- package/src/duckdb/src/optimizer/join_order/join_relation_set.cpp +30 -30
- package/src/duckdb/src/optimizer/join_order/query_graph.cpp +37 -38
- package/src/duckdb/src/parallel/executor.cpp +1 -1
- package/src/duckdb/src/parallel/meta_pipeline.cpp +2 -2
- package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +1 -1
- package/src/duckdb/src/parser/transform/tableref/transform_subquery.cpp +1 -1
- package/src/duckdb/src/parser/transformer.cpp +50 -9
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +13 -0
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +15 -5
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +19 -17
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +20 -21
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +24 -22
- package/src/duckdb/src/planner/binder/tableref/bind_subqueryref.cpp +2 -2
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +9 -0
- package/src/duckdb/src/planner/binder.cpp +16 -19
- package/src/duckdb/src/planner/expression_binder.cpp +8 -8
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +3 -3
- package/src/duckdb/src/storage/checkpoint_manager.cpp +23 -23
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +1 -1
- package/src/duckdb/src/storage/table_index_list.cpp +3 -3
- package/src/duckdb/src/verification/statement_verifier.cpp +1 -1
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +5552 -5598
- package/src/duckdb/ub_src_common.cpp +2 -0
- package/src/duckdb/ub_src_common_types.cpp +0 -16
- package/src/duckdb/ub_src_common_types_column.cpp +10 -0
- package/src/duckdb/ub_src_common_types_row.cpp +20 -0
@@ -19,12 +19,8 @@
|
|
19
19
|
|
20
20
|
namespace duckdb {
|
21
21
|
|
22
|
-
static bool CanPlanIndexJoin(ClientContext &context, TableScanBindData
|
23
|
-
|
24
|
-
// not a table scan
|
25
|
-
return false;
|
26
|
-
}
|
27
|
-
auto table = bind_data->table;
|
22
|
+
static bool CanPlanIndexJoin(ClientContext &context, TableScanBindData &bind_data, PhysicalTableScan &scan) {
|
23
|
+
auto table = bind_data.table;
|
28
24
|
auto &transaction = DuckTransaction::Get(context, *table->catalog);
|
29
25
|
auto &local_storage = LocalStorage::Get(transaction);
|
30
26
|
if (local_storage.Find(table->GetStoragePtr())) {
|
@@ -139,21 +135,23 @@ void CheckForPerfectJoinOpt(LogicalComparisonJoin &op, PerfectHashJoinStats &joi
|
|
139
135
|
return;
|
140
136
|
}
|
141
137
|
|
142
|
-
static
|
143
|
-
|
138
|
+
static optional_ptr<Index> CanUseIndexJoin(TableScanBindData &tbl, Expression &expr) {
|
139
|
+
optional_ptr<Index> result;
|
140
|
+
tbl.table->GetStorage().info->indexes.Scan([&](Index &index) {
|
144
141
|
if (index.unbound_expressions.size() != 1) {
|
145
142
|
return false;
|
146
143
|
}
|
147
144
|
if (expr.alias == index.unbound_expressions[0]->alias) {
|
148
|
-
|
145
|
+
result = &index;
|
149
146
|
return true;
|
150
147
|
}
|
151
148
|
return false;
|
152
149
|
});
|
150
|
+
return result;
|
153
151
|
}
|
154
152
|
|
155
|
-
Index
|
156
|
-
|
153
|
+
optional_ptr<Index> CheckIndexJoin(ClientContext &context, LogicalComparisonJoin &op, PhysicalOperator &plan,
|
154
|
+
Expression &condition) {
|
157
155
|
if (op.type == LogicalOperatorType::LOGICAL_DELIM_JOIN) {
|
158
156
|
return nullptr;
|
159
157
|
}
|
@@ -169,17 +167,20 @@ Index *CheckIndexJoin(ClientContext &context, LogicalComparisonJoin &op, Physica
|
|
169
167
|
return nullptr;
|
170
168
|
}
|
171
169
|
auto &tbl_scan = plan.Cast<PhysicalTableScan>();
|
172
|
-
auto
|
173
|
-
|
174
|
-
|
175
|
-
|
170
|
+
auto tbl_data = dynamic_cast<TableScanBindData *>(tbl_scan.bind_data.get());
|
171
|
+
if (!tbl_data) {
|
172
|
+
return nullptr;
|
173
|
+
}
|
174
|
+
optional_ptr<Index> result;
|
175
|
+
if (CanPlanIndexJoin(context, *tbl_data, tbl_scan)) {
|
176
|
+
result = CanUseIndexJoin(*tbl_data, condition);
|
176
177
|
}
|
177
178
|
return result;
|
178
179
|
}
|
179
180
|
|
180
181
|
static bool PlanIndexJoin(ClientContext &context, LogicalComparisonJoin &op, unique_ptr<PhysicalOperator> &plan,
|
181
|
-
unique_ptr<PhysicalOperator> &left, unique_ptr<PhysicalOperator> &right,
|
182
|
-
bool swap_condition = false) {
|
182
|
+
unique_ptr<PhysicalOperator> &left, unique_ptr<PhysicalOperator> &right,
|
183
|
+
optional_ptr<Index> index, bool swap_condition = false) {
|
183
184
|
if (!index) {
|
184
185
|
return false;
|
185
186
|
}
|
@@ -205,7 +206,7 @@ static bool PlanIndexJoin(ClientContext &context, LogicalComparisonJoin &op, uni
|
|
205
206
|
swap(op.left_projection_map, op.right_projection_map);
|
206
207
|
}
|
207
208
|
plan = make_uniq<PhysicalIndexJoin>(op, std::move(left), std::move(right), std::move(op.conditions), op.join_type,
|
208
|
-
op.left_projection_map, op.right_projection_map, tbl_scan.column_ids, index,
|
209
|
+
op.left_projection_map, op.right_projection_map, tbl_scan.column_ids, *index,
|
209
210
|
!swap_condition, op.estimated_cardinality);
|
210
211
|
return true;
|
211
212
|
}
|
@@ -16,7 +16,8 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalCopyToFile
|
|
16
16
|
auto copy = make_uniq<PhysicalCopyToFile>(op.types, op.function, std::move(op.bind_data), op.estimated_cardinality);
|
17
17
|
copy->file_path = op.file_path;
|
18
18
|
copy->use_tmp_file = op.use_tmp_file;
|
19
|
-
copy->
|
19
|
+
copy->overwrite_or_ignore = op.overwrite_or_ignore;
|
20
|
+
copy->filename_pattern = op.filename_pattern;
|
20
21
|
copy->per_thread_output = op.per_thread_output;
|
21
22
|
copy->partition_output = op.partition_output;
|
22
23
|
copy->partition_columns = op.partition_columns;
|
@@ -8,13 +8,13 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalExecute &o
|
|
8
8
|
if (!op.prepared->plan) {
|
9
9
|
D_ASSERT(op.children.size() == 1);
|
10
10
|
auto owned_plan = CreatePlan(*op.children[0]);
|
11
|
-
auto execute = make_uniq<PhysicalExecute>(owned_plan
|
11
|
+
auto execute = make_uniq<PhysicalExecute>(*owned_plan);
|
12
12
|
execute->owned_plan = std::move(owned_plan);
|
13
13
|
execute->prepared = std::move(op.prepared);
|
14
14
|
return std::move(execute);
|
15
15
|
} else {
|
16
16
|
D_ASSERT(op.children.size() == 0);
|
17
|
-
return make_uniq<PhysicalExecute>(op.prepared->plan
|
17
|
+
return make_uniq<PhysicalExecute>(*op.prepared->plan);
|
18
18
|
}
|
19
19
|
}
|
20
20
|
|
@@ -1,11 +1,10 @@
|
|
1
|
-
#include "duckdb/
|
2
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/common/tree_renderer.hpp"
|
2
|
+
#include "duckdb/common/types/column/column_data_collection.hpp"
|
3
3
|
#include "duckdb/execution/operator/helper/physical_explain_analyze.hpp"
|
4
|
-
#include "duckdb/main/client_context.hpp"
|
5
|
-
#include "duckdb/common/types/column_data_collection.hpp"
|
6
4
|
#include "duckdb/execution/operator/scan/physical_column_data_scan.hpp"
|
7
|
-
|
8
|
-
#include "duckdb/
|
5
|
+
#include "duckdb/execution/physical_plan_generator.hpp"
|
6
|
+
#include "duckdb/main/client_context.hpp"
|
7
|
+
#include "duckdb/planner/operator/logical_explain.hpp"
|
9
8
|
|
10
9
|
namespace duckdb {
|
11
10
|
|
@@ -1,8 +1,8 @@
|
|
1
|
+
#include "duckdb/common/types/column/column_data_collection.hpp"
|
2
|
+
#include "duckdb/execution/operator/scan/physical_column_data_scan.hpp"
|
1
3
|
#include "duckdb/execution/operator/scan/physical_expression_scan.hpp"
|
2
4
|
#include "duckdb/execution/physical_plan_generator.hpp"
|
3
5
|
#include "duckdb/planner/operator/logical_expression_get.hpp"
|
4
|
-
#include "duckdb/execution/operator/scan/physical_column_data_scan.hpp"
|
5
|
-
#include "duckdb/common/types/column_data_collection.hpp"
|
6
6
|
|
7
7
|
namespace duckdb {
|
8
8
|
|
@@ -1,10 +1,10 @@
|
|
1
|
-
#include "duckdb/
|
1
|
+
#include "duckdb/common/types/column/column_data_collection.hpp"
|
2
2
|
#include "duckdb/execution/operator/scan/physical_column_data_scan.hpp"
|
3
|
+
#include "duckdb/execution/operator/set/physical_recursive_cte.hpp"
|
3
4
|
#include "duckdb/execution/physical_plan_generator.hpp"
|
4
5
|
#include "duckdb/planner/expression/bound_reference_expression.hpp"
|
5
|
-
#include "duckdb/planner/operator/logical_recursive_cte.hpp"
|
6
6
|
#include "duckdb/planner/operator/logical_cteref.hpp"
|
7
|
-
#include "duckdb/
|
7
|
+
#include "duckdb/planner/operator/logical_recursive_cte.hpp"
|
8
8
|
|
9
9
|
namespace duckdb {
|
10
10
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#include "duckdb/execution/physical_plan_generator.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp"
|
4
|
-
#include "duckdb/common/types/column_data_collection.hpp"
|
4
|
+
#include "duckdb/common/types/column/column_data_collection.hpp"
|
5
5
|
#include "duckdb/execution/column_binding_resolver.hpp"
|
6
6
|
#include "duckdb/main/client_context.hpp"
|
7
7
|
#include "duckdb/main/config.hpp"
|
@@ -1,8 +1,9 @@
|
|
1
1
|
#include "duckdb/execution/radix_partitioned_hashtable.hpp"
|
2
|
-
|
2
|
+
|
3
3
|
#include "duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp"
|
4
|
-
#include "duckdb/planner/expression/bound_reference_expression.hpp"
|
5
4
|
#include "duckdb/parallel/event.hpp"
|
5
|
+
#include "duckdb/parallel/task_scheduler.hpp"
|
6
|
+
#include "duckdb/planner/expression/bound_reference_expression.hpp"
|
6
7
|
|
7
8
|
namespace duckdb {
|
8
9
|
|
@@ -334,7 +335,7 @@ public:
|
|
334
335
|
//! The current position to scan the HT for output tuples
|
335
336
|
idx_t ht_index;
|
336
337
|
//! The set of aggregate scan states
|
337
|
-
unique_ptr<
|
338
|
+
unique_ptr<TupleDataParallelScanState[]> ht_scan_states;
|
338
339
|
atomic<bool> initialized;
|
339
340
|
atomic<bool> finished;
|
340
341
|
};
|
@@ -352,8 +353,12 @@ public:
|
|
352
353
|
|
353
354
|
//! Materialized GROUP BY expressions & aggregates
|
354
355
|
DataChunk scan_chunk;
|
356
|
+
//! HT index
|
357
|
+
idx_t ht_index = DConstants::INVALID_INDEX;
|
355
358
|
//! A reference to the current HT that we are scanning
|
356
359
|
shared_ptr<GroupedAggregateHashTable> ht;
|
360
|
+
//! Scan state for the current HT
|
361
|
+
TupleDataLocalScanState scan_state;
|
357
362
|
};
|
358
363
|
|
359
364
|
unique_ptr<GlobalSourceState> RadixPartitionedHashTable::GetGlobalSourceState(ClientContext &context) const {
|
@@ -372,7 +377,7 @@ idx_t RadixPartitionedHashTable::Size(GlobalSinkState &sink_state) const {
|
|
372
377
|
|
373
378
|
idx_t count = 0;
|
374
379
|
for (const auto &ht : gstate.finalized_hts) {
|
375
|
-
count += ht->
|
380
|
+
count += ht->Count();
|
376
381
|
}
|
377
382
|
return count;
|
378
383
|
}
|
@@ -425,20 +430,32 @@ void RadixPartitionedHashTable::GetData(ExecutionContext &context, DataChunk &ch
|
|
425
430
|
idx_t elements_found = 0;
|
426
431
|
|
427
432
|
lstate.scan_chunk.Reset();
|
428
|
-
lstate.ht.reset();
|
429
433
|
if (!state.initialized) {
|
430
434
|
lock_guard<mutex> l(state.lock);
|
431
|
-
if (!state.
|
435
|
+
if (!state.initialized) {
|
436
|
+
auto &finalized_hts = gstate.finalized_hts;
|
432
437
|
state.ht_scan_states =
|
433
|
-
unique_ptr<
|
434
|
-
|
435
|
-
|
438
|
+
unique_ptr<TupleDataParallelScanState[]>(new TupleDataParallelScanState[finalized_hts.size()]);
|
439
|
+
|
440
|
+
const auto &layout = gstate.finalized_hts[0]->GetDataCollection().GetLayout();
|
441
|
+
vector<column_t> column_ids;
|
442
|
+
column_ids.reserve(layout.ColumnCount() - 1);
|
443
|
+
for (idx_t col_idx = 0; col_idx < layout.ColumnCount() - 1; col_idx++) {
|
444
|
+
column_ids.emplace_back(col_idx);
|
445
|
+
}
|
446
|
+
|
447
|
+
for (idx_t ht_idx = 0; ht_idx < finalized_hts.size(); ht_idx++) {
|
448
|
+
gstate.finalized_hts[ht_idx]->GetDataCollection().InitializeScan(
|
449
|
+
state.ht_scan_states.get()[ht_idx].scan_state, column_ids);
|
450
|
+
}
|
451
|
+
state.initialized = true;
|
436
452
|
}
|
437
|
-
state.initialized = true;
|
438
453
|
}
|
454
|
+
|
455
|
+
auto &local_scan_state = lstate.scan_state;
|
439
456
|
while (true) {
|
457
|
+
D_ASSERT(state.ht_scan_states);
|
440
458
|
idx_t ht_index;
|
441
|
-
|
442
459
|
{
|
443
460
|
lock_guard<mutex> l(state.lock);
|
444
461
|
ht_index = state.ht_index;
|
@@ -446,17 +463,22 @@ void RadixPartitionedHashTable::GetData(ExecutionContext &context, DataChunk &ch
|
|
446
463
|
state.finished = true;
|
447
464
|
return;
|
448
465
|
}
|
449
|
-
D_ASSERT(ht_index < gstate.finalized_hts.size());
|
450
|
-
lstate.ht = gstate.finalized_hts[ht_index];
|
451
|
-
D_ASSERT(lstate.ht);
|
452
466
|
}
|
453
|
-
D_ASSERT(
|
454
|
-
|
467
|
+
D_ASSERT(ht_index < gstate.finalized_hts.size());
|
468
|
+
if (lstate.ht_index != DConstants::INVALID_INDEX && ht_index != lstate.ht_index) {
|
469
|
+
lstate.ht->GetDataCollection().FinalizePinState(local_scan_state.pin_state);
|
470
|
+
}
|
471
|
+
lstate.ht_index = ht_index;
|
472
|
+
lstate.ht = gstate.finalized_hts[ht_index];
|
455
473
|
D_ASSERT(lstate.ht);
|
456
|
-
|
474
|
+
|
475
|
+
auto &global_scan_state = state.ht_scan_states[ht_index];
|
476
|
+
elements_found = lstate.ht->Scan(global_scan_state, local_scan_state, lstate.scan_chunk);
|
457
477
|
if (elements_found > 0) {
|
458
478
|
break;
|
459
479
|
}
|
480
|
+
lstate.ht->GetDataCollection().FinalizePinState(local_scan_state.pin_state);
|
481
|
+
|
460
482
|
// move to the next hash table
|
461
483
|
lock_guard<mutex> l(state.lock);
|
462
484
|
ht_index++;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
#include "duckdb/function/aggregate_function.hpp"
|
2
1
|
#include "duckdb/common/sort/sort.hpp"
|
3
|
-
#include "duckdb/common/types/column_data_collection.hpp"
|
2
|
+
#include "duckdb/common/types/column/column_data_collection.hpp"
|
3
|
+
#include "duckdb/function/aggregate_function.hpp"
|
4
4
|
#include "duckdb/function/function_binder.hpp"
|
5
5
|
#include "duckdb/storage/buffer_manager.hpp"
|
6
6
|
#include "duckdb/planner/expression/bound_aggregate_expression.hpp"
|
@@ -1,12 +1,12 @@
|
|
1
|
-
#include "duckdb/function/table/system_functions.hpp"
|
2
1
|
#include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
|
3
2
|
#include "duckdb/catalog/catalog_entry/view_catalog_entry.hpp"
|
4
|
-
#include "duckdb/
|
5
|
-
#include "duckdb/
|
3
|
+
#include "duckdb/common/limits.hpp"
|
4
|
+
#include "duckdb/common/types/column/column_data_collection.hpp"
|
5
|
+
#include "duckdb/function/table/system_functions.hpp"
|
6
6
|
#include "duckdb/main/client_context.hpp"
|
7
7
|
#include "duckdb/main/client_data.hpp"
|
8
|
-
#include "duckdb/
|
9
|
-
#include "duckdb/
|
8
|
+
#include "duckdb/main/query_profiler.hpp"
|
9
|
+
#include "duckdb/planner/constraints/bound_not_null_constraint.hpp"
|
10
10
|
|
11
11
|
namespace duckdb {
|
12
12
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
#include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
|
2
2
|
#include "duckdb/catalog/catalog_entry/view_catalog_entry.hpp"
|
3
3
|
#include "duckdb/common/limits.hpp"
|
4
|
+
#include "duckdb/common/types/column/column_data_collection.hpp"
|
4
5
|
#include "duckdb/function/table/system_functions.hpp"
|
5
6
|
#include "duckdb/main/client_context.hpp"
|
6
7
|
#include "duckdb/main/client_data.hpp"
|
7
|
-
#include "duckdb/planner/constraints/bound_not_null_constraint.hpp"
|
8
8
|
#include "duckdb/main/query_profiler.hpp"
|
9
|
-
#include "duckdb/
|
9
|
+
#include "duckdb/planner/constraints/bound_not_null_constraint.hpp"
|
10
10
|
|
11
11
|
namespace duckdb {
|
12
12
|
|