duckdb 0.7.2-dev2233.0 → 0.7.2-dev2320.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 +1 -0
- package/package.json +1 -1
- package/src/duckdb/src/catalog/catalog.cpp +18 -17
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +0 -4
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +0 -4
- package/src/duckdb/src/catalog/catalog_set.cpp +3 -3
- package/src/duckdb/src/common/adbc/adbc.cpp +441 -0
- package/src/duckdb/src/common/adbc/driver_manager.cpp +749 -0
- package/src/duckdb/src/common/arrow/arrow_wrapper.cpp +1 -1
- package/src/duckdb/src/common/tree_renderer.cpp +3 -3
- package/src/duckdb/src/common/types/conflict_manager.cpp +2 -1
- package/src/duckdb/src/execution/column_binding_resolver.cpp +1 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +1 -1
- package/src/duckdb/src/execution/operator/filter/physical_filter.cpp +2 -2
- package/src/duckdb/src/execution/operator/helper/physical_execute.cpp +2 -2
- package/src/duckdb/src/execution/operator/helper/physical_result_collector.cpp +5 -5
- package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +11 -10
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +3 -3
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +9 -9
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +4 -4
- package/src/duckdb/src/execution/operator/join/physical_join.cpp +7 -7
- package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +3 -3
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +3 -3
- package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +8 -9
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +20 -19
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +3 -3
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +25 -24
- package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +1 -1
- package/src/duckdb/src/execution/operator/projection/physical_projection.cpp +2 -2
- package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +12 -6
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +10 -11
- package/src/duckdb/src/execution/operator/set/physical_union.cpp +2 -2
- package/src/duckdb/src/execution/physical_operator.cpp +13 -13
- package/src/duckdb/src/execution/physical_plan/plan_column_data_get.cpp +2 -4
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +5 -5
- package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +3 -3
- package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +6 -7
- package/src/duckdb/src/execution/physical_plan/plan_explain.cpp +2 -4
- package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_show_select.cpp +2 -4
- package/src/duckdb/src/execution/physical_plan/plan_update.cpp +3 -3
- package/src/duckdb/src/function/compression_config.cpp +9 -9
- package/src/duckdb/src/function/scalar/date/strftime.cpp +1 -1
- package/src/duckdb/src/function/table/copy_csv.cpp +5 -0
- package/src/duckdb/src/function/table/pragma_detailed_profiling_output.cpp +6 -5
- package/src/duckdb/src/function/table/pragma_last_profiling_output.cpp +7 -5
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_dependencies.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_extensions.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_keywords.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_settings.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_temporary_files.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_types.cpp +1 -1
- package/src/duckdb/src/function/table/system/pragma_collations.cpp +1 -1
- package/src/duckdb/src/function/table/system/pragma_database_size.cpp +1 -1
- package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +5 -5
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +1 -1
- package/src/duckdb/src/function/table/system/test_all_types.cpp +1 -1
- package/src/duckdb/src/function/table/table_scan.cpp +3 -4
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +1 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +1 -2
- package/src/duckdb/src/include/duckdb/common/adbc/adbc-init.hpp +37 -0
- package/src/duckdb/src/include/duckdb/common/adbc/adbc.h +1088 -0
- package/src/duckdb/src/include/duckdb/common/adbc/adbc.hpp +85 -0
- package/src/duckdb/src/include/duckdb/common/adbc/driver_manager.h +84 -0
- package/src/duckdb/src/include/duckdb/common/helper.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/types/conflict_manager.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/types.hpp +0 -1
- package/src/duckdb/src/include/duckdb/execution/executor.hpp +7 -7
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_execute.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_result_collector.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_delim_join.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_index_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +3 -4
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_union.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +3 -3
- package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/cast/cast_function_set.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/config.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +10 -9
- package/src/duckdb/src/include/duckdb/parallel/meta_pipeline.hpp +4 -4
- package/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +18 -17
- package/src/duckdb/src/include/duckdb/parallel/pipeline_executor.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +14 -17
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +6 -6
- package/src/duckdb/src/include/duckdb/planner/expression_binder/index_binder.hpp +4 -4
- package/src/duckdb/src/include/duckdb/planner/expression_binder/where_binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +3 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_function_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/planner/parsed_data/bound_create_table_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/planner/table_binding.hpp +6 -5
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_basetableref.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +3 -7
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_compress.hpp +3 -7
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/column_data_checkpointer.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +4 -4
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +3 -3
- package/src/duckdb/src/include/duckdb/transaction/cleanup_state.hpp +3 -3
- package/src/duckdb/src/include/duckdb/transaction/commit_state.hpp +5 -5
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +3 -3
- package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +31 -30
- package/src/duckdb/src/include/duckdb/transaction/transaction_data.hpp +2 -1
- package/src/duckdb/src/include/duckdb/transaction/undo_buffer.hpp +1 -1
- package/src/duckdb/src/main/client_context.cpp +1 -1
- package/src/duckdb/src/main/query_profiler.cpp +24 -22
- package/src/duckdb/src/parallel/executor.cpp +55 -49
- package/src/duckdb/src/parallel/meta_pipeline.cpp +5 -5
- package/src/duckdb/src/parallel/pipeline.cpp +43 -26
- package/src/duckdb/src/parallel/pipeline_executor.cpp +22 -22
- package/src/duckdb/src/planner/bind_context.cpp +67 -71
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +6 -7
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +6 -8
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +3 -4
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +17 -18
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +16 -17
- package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +6 -5
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +9 -9
- package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +20 -18
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +1 -1
- package/src/duckdb/src/planner/binder.cpp +4 -4
- package/src/duckdb/src/planner/expression_binder/index_binder.cpp +2 -1
- package/src/duckdb/src/planner/expression_binder/where_binder.cpp +3 -2
- package/src/duckdb/src/planner/operator/logical_create_table.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_delete.cpp +5 -5
- package/src/duckdb/src/planner/operator/logical_insert.cpp +6 -7
- package/src/duckdb/src/planner/operator/logical_update.cpp +6 -7
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +4 -5
- package/src/duckdb/src/planner/table_binding.cpp +6 -5
- package/src/duckdb/src/storage/compression/bitpacking.cpp +5 -6
- package/src/duckdb/src/storage/compression/dictionary_compression.cpp +5 -6
- package/src/duckdb/src/storage/compression/fsst.cpp +3 -5
- package/src/duckdb/src/storage/compression/rle.cpp +4 -6
- package/src/duckdb/src/storage/data_table.cpp +27 -28
- package/src/duckdb/src/storage/local_storage.cpp +70 -68
- package/src/duckdb/src/storage/storage_manager.cpp +12 -13
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +2 -2
- package/src/duckdb/src/storage/table/column_data.cpp +2 -2
- package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +18 -6
- package/src/duckdb/src/storage/table/column_segment.cpp +23 -24
- package/src/duckdb/src/storage/table/row_group.cpp +3 -3
- package/src/duckdb/src/storage/table/row_group_collection.cpp +1 -1
- package/src/duckdb/src/storage/table/update_segment.cpp +15 -15
- package/src/duckdb/src/storage/wal_replay.cpp +1 -1
- package/src/duckdb/src/transaction/cleanup_state.cpp +10 -10
- package/src/duckdb/src/transaction/commit_state.cpp +19 -19
- package/src/duckdb/src/transaction/duck_transaction.cpp +7 -7
- package/src/duckdb/src/transaction/rollback_state.cpp +1 -1
- package/src/duckdb/src/transaction/undo_buffer.cpp +2 -1
- package/src/duckdb/ub_src_common_adbc.cpp +4 -0
- package/src/duckdb/src/include/duckdb/common/single_thread_ptr.hpp +0 -185
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
namespace duckdb {
|
22
22
|
|
23
|
-
PhysicalInsert::PhysicalInsert(vector<LogicalType> types_p, TableCatalogEntry
|
23
|
+
PhysicalInsert::PhysicalInsert(vector<LogicalType> types_p, TableCatalogEntry &table,
|
24
24
|
physical_index_vector_t<idx_t> column_index_map,
|
25
25
|
vector<unique_ptr<Expression>> bound_defaults,
|
26
26
|
vector<unique_ptr<Expression>> set_expressions, vector<PhysicalIndex> set_columns,
|
@@ -30,7 +30,7 @@ PhysicalInsert::PhysicalInsert(vector<LogicalType> types_p, TableCatalogEntry *t
|
|
30
30
|
unique_ptr<Expression> do_update_condition_p, unordered_set<column_t> conflict_target_p,
|
31
31
|
vector<column_t> columns_to_fetch_p)
|
32
32
|
: PhysicalOperator(PhysicalOperatorType::INSERT, std::move(types_p), estimated_cardinality),
|
33
|
-
column_index_map(std::move(column_index_map)), insert_table(table), insert_types(table
|
33
|
+
column_index_map(std::move(column_index_map)), insert_table(&table), insert_types(table.GetTypes()),
|
34
34
|
bound_defaults(std::move(bound_defaults)), return_chunk(return_chunk), parallel(parallel),
|
35
35
|
action_type(action_type), set_expressions(std::move(set_expressions)), set_columns(std::move(set_columns)),
|
36
36
|
set_types(std::move(set_types)), on_conflict_condition(std::move(on_conflict_condition_p)),
|
@@ -75,12 +75,12 @@ void PhysicalInsert::GetInsertInfo(const BoundCreateTableInfo &info, vector<Logi
|
|
75
75
|
//===--------------------------------------------------------------------===//
|
76
76
|
class InsertGlobalState : public GlobalSinkState {
|
77
77
|
public:
|
78
|
-
explicit InsertGlobalState(ClientContext &context, const vector<LogicalType> &return_types)
|
79
|
-
: insert_count(0), initialized(false), return_collection(context, return_types) {
|
78
|
+
explicit InsertGlobalState(ClientContext &context, const vector<LogicalType> &return_types, DuckTableEntry &table)
|
79
|
+
: table(table), insert_count(0), initialized(false), return_collection(context, return_types) {
|
80
80
|
}
|
81
81
|
|
82
82
|
mutex lock;
|
83
|
-
|
83
|
+
DuckTableEntry &table;
|
84
84
|
idx_t insert_count;
|
85
85
|
bool initialized;
|
86
86
|
LocalAppendState append_state;
|
@@ -105,18 +105,19 @@ public:
|
|
105
105
|
};
|
106
106
|
|
107
107
|
unique_ptr<GlobalSinkState> PhysicalInsert::GetGlobalSinkState(ClientContext &context) const {
|
108
|
-
|
108
|
+
optional_ptr<TableCatalogEntry> table;
|
109
109
|
if (info) {
|
110
110
|
// CREATE TABLE AS
|
111
111
|
D_ASSERT(!insert_table);
|
112
112
|
auto &catalog = *schema->catalog;
|
113
|
-
|
114
|
-
|
113
|
+
table = (TableCatalogEntry *)catalog.CreateTable(catalog.GetCatalogTransaction(context), *schema.get_mutable(),
|
114
|
+
info.get());
|
115
115
|
} else {
|
116
116
|
D_ASSERT(insert_table);
|
117
117
|
D_ASSERT(insert_table->IsDuckTable());
|
118
|
-
|
118
|
+
table = insert_table.get_mutable();
|
119
119
|
}
|
120
|
+
auto result = make_uniq<InsertGlobalState>(context, GetTypes(), table->Cast<DuckTableEntry>());
|
120
121
|
return std::move(result);
|
121
122
|
}
|
122
123
|
|
@@ -357,9 +358,9 @@ SinkResultType PhysicalInsert::Sink(ExecutionContext &context, GlobalSinkState &
|
|
357
358
|
auto &gstate = state.Cast<InsertGlobalState>();
|
358
359
|
auto &lstate = lstate_p.Cast<InsertLocalState>();
|
359
360
|
|
360
|
-
auto table = gstate.table;
|
361
|
-
auto &storage = table
|
362
|
-
PhysicalInsert::ResolveDefaults(
|
361
|
+
auto &table = gstate.table;
|
362
|
+
auto &storage = table.GetStorage();
|
363
|
+
PhysicalInsert::ResolveDefaults(table, chunk, column_index_map, lstate.default_executor, lstate.insert_chunk);
|
363
364
|
|
364
365
|
if (!parallel) {
|
365
366
|
if (!gstate.initialized) {
|
@@ -367,8 +368,8 @@ SinkResultType PhysicalInsert::Sink(ExecutionContext &context, GlobalSinkState &
|
|
367
368
|
gstate.initialized = true;
|
368
369
|
}
|
369
370
|
|
370
|
-
OnConflictHandling(
|
371
|
-
storage.LocalAppend(gstate.append_state,
|
371
|
+
OnConflictHandling(table, context, lstate);
|
372
|
+
storage.LocalAppend(gstate.append_state, table, context.client, lstate.insert_chunk, true);
|
372
373
|
|
373
374
|
if (return_chunk) {
|
374
375
|
gstate.return_collection.Append(lstate.insert_chunk);
|
@@ -385,9 +386,9 @@ SinkResultType PhysicalInsert::Sink(ExecutionContext &context, GlobalSinkState &
|
|
385
386
|
make_uniq<RowGroupCollection>(table_info, block_manager, insert_types, MAX_ROW_ID);
|
386
387
|
lstate.local_collection->InitializeEmpty();
|
387
388
|
lstate.local_collection->InitializeAppend(lstate.local_append_state);
|
388
|
-
lstate.writer = gstate.table
|
389
|
+
lstate.writer = &gstate.table.GetStorage().CreateOptimisticWriter(context.client);
|
389
390
|
}
|
390
|
-
OnConflictHandling(
|
391
|
+
OnConflictHandling(table, context, lstate);
|
391
392
|
auto new_row_group = lstate.local_collection->Append(lstate.insert_chunk, lstate.local_append_state);
|
392
393
|
if (new_row_group) {
|
393
394
|
lstate.writer->CheckFlushToDisk(*lstate.local_collection);
|
@@ -401,7 +402,7 @@ void PhysicalInsert::Combine(ExecutionContext &context, GlobalSinkState &gstate_
|
|
401
402
|
auto &gstate = gstate_p.Cast<InsertGlobalState>();
|
402
403
|
auto &lstate = lstate_p.Cast<InsertLocalState>();
|
403
404
|
auto &client_profiler = QueryProfiler::Get(context.client);
|
404
|
-
context.thread.profiler.Flush(this,
|
405
|
+
context.thread.profiler.Flush(*this, lstate.default_executor, "default_executor", 1);
|
405
406
|
client_profiler.Flush(context.thread.profiler);
|
406
407
|
|
407
408
|
if (!parallel) {
|
@@ -420,12 +421,12 @@ void PhysicalInsert::Combine(ExecutionContext &context, GlobalSinkState &gstate_
|
|
420
421
|
// we have few rows - append to the local storage directly
|
421
422
|
lock_guard<mutex> lock(gstate.lock);
|
422
423
|
gstate.insert_count += append_count;
|
423
|
-
auto table = gstate.table;
|
424
|
-
auto &storage = table
|
424
|
+
auto &table = gstate.table;
|
425
|
+
auto &storage = table.GetStorage();
|
425
426
|
storage.InitializeLocalAppend(gstate.append_state, context.client);
|
426
|
-
auto &transaction = DuckTransaction::Get(context.client, *table
|
427
|
+
auto &transaction = DuckTransaction::Get(context.client, *table.catalog);
|
427
428
|
lstate.local_collection->Scan(transaction, [&](DataChunk &insert_chunk) {
|
428
|
-
storage.LocalAppend(gstate.append_state,
|
429
|
+
storage.LocalAppend(gstate.append_state, table, context.client, insert_chunk);
|
429
430
|
return true;
|
430
431
|
});
|
431
432
|
storage.FinalizeLocalAppend(gstate.append_state);
|
@@ -437,7 +438,7 @@ void PhysicalInsert::Combine(ExecutionContext &context, GlobalSinkState &gstate_
|
|
437
438
|
|
438
439
|
lock_guard<mutex> lock(gstate.lock);
|
439
440
|
gstate.insert_count += append_count;
|
440
|
-
gstate.table
|
441
|
+
gstate.table.GetStorage().LocalMerge(context.client, *lstate.local_collection);
|
441
442
|
}
|
442
443
|
}
|
443
444
|
|
@@ -445,8 +446,8 @@ SinkFinalizeType PhysicalInsert::Finalize(Pipeline &pipeline, Event &event, Clie
|
|
445
446
|
GlobalSinkState &state) const {
|
446
447
|
auto &gstate = state.Cast<InsertGlobalState>();
|
447
448
|
if (!parallel && gstate.initialized) {
|
448
|
-
auto table = gstate.table;
|
449
|
-
auto &storage = table
|
449
|
+
auto &table = gstate.table;
|
450
|
+
auto &storage = table.GetStorage();
|
450
451
|
storage.FinalizeLocalAppend(gstate.append_state);
|
451
452
|
}
|
452
453
|
return SinkFinalizeType::READY;
|
@@ -144,7 +144,7 @@ unique_ptr<LocalSinkState> PhysicalUpdate::GetLocalSinkState(ExecutionContext &c
|
|
144
144
|
void PhysicalUpdate::Combine(ExecutionContext &context, GlobalSinkState &gstate, LocalSinkState &lstate) const {
|
145
145
|
auto &state = lstate.Cast<UpdateLocalState>();
|
146
146
|
auto &client_profiler = QueryProfiler::Get(context.client);
|
147
|
-
context.thread.profiler.Flush(this,
|
147
|
+
context.thread.profiler.Flush(*this, state.default_executor, "default_executor", 1);
|
148
148
|
client_profiler.Flush(context.thread.profiler);
|
149
149
|
}
|
150
150
|
|
@@ -14,8 +14,8 @@ public:
|
|
14
14
|
ExpressionExecutor executor;
|
15
15
|
|
16
16
|
public:
|
17
|
-
void Finalize(PhysicalOperator
|
18
|
-
context.thread.profiler.Flush(op,
|
17
|
+
void Finalize(const PhysicalOperator &op, ExecutionContext &context) override {
|
18
|
+
context.thread.profiler.Flush(op, executor, "projection", 0);
|
19
19
|
}
|
20
20
|
};
|
21
21
|
|
@@ -6,6 +6,13 @@
|
|
6
6
|
|
7
7
|
namespace duckdb {
|
8
8
|
|
9
|
+
PhysicalColumnDataScan::PhysicalColumnDataScan(vector<LogicalType> types, PhysicalOperatorType op_type,
|
10
|
+
idx_t estimated_cardinality,
|
11
|
+
unique_ptr<ColumnDataCollection> owned_collection_p)
|
12
|
+
: PhysicalOperator(op_type, std::move(types), estimated_cardinality), collection(owned_collection_p.get()),
|
13
|
+
owned_collection(std::move(owned_collection_p)) {
|
14
|
+
}
|
15
|
+
|
9
16
|
class PhysicalColumnDataScanState : public GlobalSourceState {
|
10
17
|
public:
|
11
18
|
explicit PhysicalColumnDataScanState() : initialized(false) {
|
@@ -23,7 +30,6 @@ unique_ptr<GlobalSourceState> PhysicalColumnDataScan::GetGlobalSourceState(Clien
|
|
23
30
|
void PhysicalColumnDataScan::GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
|
24
31
|
LocalSourceState &lstate) const {
|
25
32
|
auto &state = gstate.Cast<PhysicalColumnDataScanState>();
|
26
|
-
D_ASSERT(collection);
|
27
33
|
if (collection->Count() == 0) {
|
28
34
|
return;
|
29
35
|
}
|
@@ -42,17 +48,17 @@ void PhysicalColumnDataScan::BuildPipelines(Pipeline ¤t, MetaPipeline &met
|
|
42
48
|
auto &state = meta_pipeline.GetState();
|
43
49
|
switch (type) {
|
44
50
|
case PhysicalOperatorType::DELIM_SCAN: {
|
45
|
-
auto entry = state.delim_join_dependencies.find(this);
|
51
|
+
auto entry = state.delim_join_dependencies.find(*this);
|
46
52
|
D_ASSERT(entry != state.delim_join_dependencies.end());
|
47
53
|
// this chunk scan introduces a dependency to the current pipeline
|
48
54
|
// namely a dependency on the duplicate elimination pipeline to finish
|
49
|
-
auto delim_dependency = entry->second
|
55
|
+
auto delim_dependency = entry->second.get().shared_from_this();
|
50
56
|
auto delim_sink = state.GetPipelineSink(*delim_dependency);
|
51
57
|
D_ASSERT(delim_sink);
|
52
58
|
D_ASSERT(delim_sink->type == PhysicalOperatorType::DELIM_JOIN);
|
53
|
-
auto &delim_join = (
|
59
|
+
auto &delim_join = delim_sink->Cast<PhysicalDelimJoin>();
|
54
60
|
current.AddDependency(delim_dependency);
|
55
|
-
state.SetPipelineSource(current, (PhysicalOperator *
|
61
|
+
state.SetPipelineSource(current, (PhysicalOperator &)*delim_join.distinct);
|
56
62
|
return;
|
57
63
|
}
|
58
64
|
case PhysicalOperatorType::RECURSIVE_CTE_SCAN:
|
@@ -64,7 +70,7 @@ void PhysicalColumnDataScan::BuildPipelines(Pipeline ¤t, MetaPipeline &met
|
|
64
70
|
break;
|
65
71
|
}
|
66
72
|
D_ASSERT(children.empty());
|
67
|
-
state.SetPipelineSource(current, this);
|
73
|
+
state.SetPipelineSource(current, *this);
|
68
74
|
}
|
69
75
|
|
70
76
|
} // namespace duckdb
|
@@ -130,13 +130,12 @@ void PhysicalRecursiveCTE::ExecuteRecursivePipelines(ExecutionContext &context)
|
|
130
130
|
recursive_meta_pipeline->GetPipelines(pipelines, true);
|
131
131
|
for (auto &pipeline : pipelines) {
|
132
132
|
auto sink = pipeline->GetSink();
|
133
|
-
if (sink != this) {
|
133
|
+
if (sink.get() != this) {
|
134
134
|
sink->sink_state.reset();
|
135
135
|
}
|
136
|
-
for (auto &
|
137
|
-
|
138
|
-
|
139
|
-
}
|
136
|
+
for (auto &op_ref : pipeline->GetOperators()) {
|
137
|
+
auto &op = op_ref.get();
|
138
|
+
op.op_state.reset();
|
140
139
|
}
|
141
140
|
pipeline->ClearSource();
|
142
141
|
}
|
@@ -176,14 +175,14 @@ void PhysicalRecursiveCTE::BuildPipelines(Pipeline ¤t, MetaPipeline &meta_
|
|
176
175
|
recursive_meta_pipeline.reset();
|
177
176
|
|
178
177
|
auto &state = meta_pipeline.GetState();
|
179
|
-
state.SetPipelineSource(current, this);
|
178
|
+
state.SetPipelineSource(current, *this);
|
180
179
|
|
181
180
|
auto &executor = meta_pipeline.GetExecutor();
|
182
|
-
executor.AddRecursiveCTE(this);
|
181
|
+
executor.AddRecursiveCTE(*this);
|
183
182
|
|
184
183
|
// the LHS of the recursive CTE is our initial state
|
185
|
-
auto initial_state_pipeline = meta_pipeline.CreateChildMetaPipeline(current, this);
|
186
|
-
initial_state_pipeline
|
184
|
+
auto &initial_state_pipeline = meta_pipeline.CreateChildMetaPipeline(current, *this);
|
185
|
+
initial_state_pipeline.Build(*children[0]);
|
187
186
|
|
188
187
|
// the RHS is the recursive pipeline
|
189
188
|
recursive_meta_pipeline = make_shared<MetaPipeline>(executor, state, this);
|
@@ -191,8 +190,8 @@ void PhysicalRecursiveCTE::BuildPipelines(Pipeline ¤t, MetaPipeline &meta_
|
|
191
190
|
recursive_meta_pipeline->Build(*children[1]);
|
192
191
|
}
|
193
192
|
|
194
|
-
vector<
|
195
|
-
return {this};
|
193
|
+
vector<const_reference<PhysicalOperator>> PhysicalRecursiveCTE::GetSources() const {
|
194
|
+
return {*this};
|
196
195
|
}
|
197
196
|
|
198
197
|
} // namespace duckdb
|
@@ -55,8 +55,8 @@ void PhysicalUnion::BuildPipelines(Pipeline ¤t, MetaPipeline &meta_pipelin
|
|
55
55
|
meta_pipeline.AssignNextBatchIndex(union_pipeline);
|
56
56
|
}
|
57
57
|
|
58
|
-
vector<
|
59
|
-
vector<
|
58
|
+
vector<const_reference<PhysicalOperator>> PhysicalUnion::GetSources() const {
|
59
|
+
vector<const_reference<PhysicalOperator>> result;
|
60
60
|
for (auto &child : children) {
|
61
61
|
auto child_sources = child->GetSources();
|
62
62
|
result.insert(result.end(), child_sources.begin(), child_sources.end());
|
@@ -28,10 +28,10 @@ void PhysicalOperator::Print() const {
|
|
28
28
|
}
|
29
29
|
// LCOV_EXCL_STOP
|
30
30
|
|
31
|
-
vector<PhysicalOperator
|
32
|
-
vector<PhysicalOperator
|
31
|
+
vector<const_reference<PhysicalOperator>> PhysicalOperator::GetChildren() const {
|
32
|
+
vector<const_reference<PhysicalOperator>> result;
|
33
33
|
for (auto &child : children) {
|
34
|
-
result.push_back(child
|
34
|
+
result.push_back(*child);
|
35
35
|
}
|
36
36
|
return result;
|
37
37
|
}
|
@@ -134,36 +134,36 @@ void PhysicalOperator::BuildPipelines(Pipeline ¤t, MetaPipeline &meta_pipe
|
|
134
134
|
D_ASSERT(children.size() == 1);
|
135
135
|
|
136
136
|
// single operator: the operator becomes the data source of the current pipeline
|
137
|
-
state.SetPipelineSource(current, this);
|
137
|
+
state.SetPipelineSource(current, *this);
|
138
138
|
|
139
139
|
// we create a new pipeline starting from the child
|
140
|
-
auto child_meta_pipeline = meta_pipeline.CreateChildMetaPipeline(current, this);
|
141
|
-
child_meta_pipeline
|
140
|
+
auto &child_meta_pipeline = meta_pipeline.CreateChildMetaPipeline(current, *this);
|
141
|
+
child_meta_pipeline.Build(*children[0]);
|
142
142
|
} else {
|
143
143
|
// operator is not a sink! recurse in children
|
144
144
|
if (children.empty()) {
|
145
145
|
// source
|
146
|
-
state.SetPipelineSource(current, this);
|
146
|
+
state.SetPipelineSource(current, *this);
|
147
147
|
} else {
|
148
148
|
if (children.size() != 1) {
|
149
149
|
throw InternalException("Operator not supported in BuildPipelines");
|
150
150
|
}
|
151
|
-
state.AddPipelineOperator(current, this);
|
151
|
+
state.AddPipelineOperator(current, *this);
|
152
152
|
children[0]->BuildPipelines(current, meta_pipeline);
|
153
153
|
}
|
154
154
|
}
|
155
155
|
}
|
156
156
|
|
157
|
-
vector<
|
158
|
-
vector<
|
157
|
+
vector<const_reference<PhysicalOperator>> PhysicalOperator::GetSources() const {
|
158
|
+
vector<const_reference<PhysicalOperator>> result;
|
159
159
|
if (IsSink()) {
|
160
160
|
D_ASSERT(children.size() == 1);
|
161
|
-
result.push_back(this);
|
161
|
+
result.push_back(*this);
|
162
162
|
return result;
|
163
163
|
} else {
|
164
164
|
if (children.empty()) {
|
165
165
|
// source
|
166
|
-
result.push_back(this);
|
166
|
+
result.push_back(*this);
|
167
167
|
return result;
|
168
168
|
} else {
|
169
169
|
if (children.size() != 1) {
|
@@ -177,7 +177,7 @@ vector<const PhysicalOperator *> PhysicalOperator::GetSources() const {
|
|
177
177
|
bool PhysicalOperator::AllSourcesSupportBatchIndex() const {
|
178
178
|
auto sources = GetSources();
|
179
179
|
for (auto &source : sources) {
|
180
|
-
if (!source
|
180
|
+
if (!source.get().SupportsBatchIndex()) {
|
181
181
|
return false;
|
182
182
|
}
|
183
183
|
}
|
@@ -9,10 +9,8 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalColumnData
|
|
9
9
|
D_ASSERT(op.collection);
|
10
10
|
|
11
11
|
// create a PhysicalChunkScan pointing towards the owned collection
|
12
|
-
auto chunk_scan =
|
13
|
-
|
14
|
-
chunk_scan->owned_collection = std::move(op.collection);
|
15
|
-
chunk_scan->collection = chunk_scan->owned_collection.get();
|
12
|
+
auto chunk_scan = make_uniq<PhysicalColumnDataScan>(op.types, PhysicalOperatorType::COLUMN_DATA_SCAN,
|
13
|
+
op.estimated_cardinality, std::move(op.collection));
|
16
14
|
return std::move(chunk_scan);
|
17
15
|
}
|
18
16
|
|
@@ -23,7 +23,7 @@ static bool CanPlanIndexJoin(ClientContext &context, TableScanBindData &bind_dat
|
|
23
23
|
auto table = bind_data.table;
|
24
24
|
auto &transaction = DuckTransaction::Get(context, *table->catalog);
|
25
25
|
auto &local_storage = LocalStorage::Get(transaction);
|
26
|
-
if (local_storage.Find(table->
|
26
|
+
if (local_storage.Find(table->GetStorage())) {
|
27
27
|
// transaction local appends: skip index join
|
28
28
|
return false;
|
29
29
|
}
|
@@ -21,10 +21,10 @@ unique_ptr<PhysicalOperator> DuckCatalog::PlanCreateTableAs(ClientContext &conte
|
|
21
21
|
auto num_threads = TaskScheduler::GetScheduler(context).NumberOfThreads();
|
22
22
|
unique_ptr<PhysicalOperator> create;
|
23
23
|
if (!parallel_streaming_insert && use_batch_index) {
|
24
|
-
create = make_uniq<PhysicalBatchInsert>(op,
|
24
|
+
create = make_uniq<PhysicalBatchInsert>(op, op.schema, std::move(op.info), op.estimated_cardinality);
|
25
25
|
|
26
26
|
} else {
|
27
|
-
create = make_uniq<PhysicalInsert>(op,
|
27
|
+
create = make_uniq<PhysicalInsert>(op, op.schema, std::move(op.info), op.estimated_cardinality,
|
28
28
|
parallel_streaming_insert && num_threads > 1);
|
29
29
|
}
|
30
30
|
|
@@ -35,14 +35,14 @@ unique_ptr<PhysicalOperator> DuckCatalog::PlanCreateTableAs(ClientContext &conte
|
|
35
35
|
|
36
36
|
unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalCreateTable &op) {
|
37
37
|
const auto &create_info = (CreateTableInfo &)*op.info->base;
|
38
|
-
auto &catalog = *op.info->schema
|
38
|
+
auto &catalog = *op.info->schema.catalog;
|
39
39
|
auto existing_entry = catalog.GetEntry<TableCatalogEntry>(context, create_info.schema, create_info.table, true);
|
40
40
|
bool replace = op.info->Base().on_conflict == OnCreateConflict::REPLACE_ON_CONFLICT;
|
41
41
|
if ((!existing_entry || replace) && !op.children.empty()) {
|
42
42
|
auto plan = CreatePlan(*op.children[0]);
|
43
|
-
return op.schema
|
43
|
+
return op.schema.catalog->PlanCreateTableAs(context, op, std::move(plan));
|
44
44
|
} else {
|
45
|
-
return make_uniq<PhysicalCreateTable>(op,
|
45
|
+
return make_uniq<PhysicalCreateTable>(op, op.schema, std::move(op.info), op.estimated_cardinality);
|
46
46
|
}
|
47
47
|
}
|
48
48
|
|
@@ -12,7 +12,7 @@ unique_ptr<PhysicalOperator> DuckCatalog::PlanDelete(ClientContext &context, Log
|
|
12
12
|
// get the index of the row_id column
|
13
13
|
auto &bound_ref = op.expressions[0]->Cast<BoundReferenceExpression>();
|
14
14
|
|
15
|
-
auto del = make_uniq<PhysicalDelete>(op.types,
|
15
|
+
auto del = make_uniq<PhysicalDelete>(op.types, op.table, op.table.GetStorage(), bound_ref.index,
|
16
16
|
op.estimated_cardinality, op.return_chunk);
|
17
17
|
del->children.push_back(std::move(plan));
|
18
18
|
return std::move(del);
|
@@ -25,8 +25,8 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalDelete &op
|
|
25
25
|
|
26
26
|
auto plan = CreatePlan(*op.children[0]);
|
27
27
|
|
28
|
-
dependencies.AddDependency(
|
29
|
-
return op.table
|
28
|
+
dependencies.AddDependency(op.table);
|
29
|
+
return op.table.catalog->PlanDelete(context, op, std::move(plan));
|
30
30
|
}
|
31
31
|
|
32
32
|
} // namespace duckdb
|
@@ -10,13 +10,12 @@
|
|
10
10
|
|
11
11
|
namespace duckdb {
|
12
12
|
|
13
|
-
static void GatherDelimScans(PhysicalOperator
|
14
|
-
|
15
|
-
if (op->type == PhysicalOperatorType::DELIM_SCAN) {
|
13
|
+
static void GatherDelimScans(const PhysicalOperator &op, vector<const_reference<PhysicalOperator>> &delim_scans) {
|
14
|
+
if (op.type == PhysicalOperatorType::DELIM_SCAN) {
|
16
15
|
delim_scans.push_back(op);
|
17
16
|
}
|
18
|
-
for (auto &child : op
|
19
|
-
GatherDelimScans(child
|
17
|
+
for (auto &child : op.children) {
|
18
|
+
GatherDelimScans(*child, delim_scans);
|
20
19
|
}
|
21
20
|
}
|
22
21
|
|
@@ -27,8 +26,8 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalDelimJoin
|
|
27
26
|
D_ASSERT(plan && plan->type != PhysicalOperatorType::CROSS_PRODUCT);
|
28
27
|
// duplicate eliminated join
|
29
28
|
// first gather the scans on the duplicate eliminated data set from the RHS
|
30
|
-
vector<PhysicalOperator
|
31
|
-
GatherDelimScans(plan->children[1]
|
29
|
+
vector<const_reference<PhysicalOperator>> delim_scans;
|
30
|
+
GatherDelimScans(*plan->children[1], delim_scans);
|
32
31
|
if (delim_scans.empty()) {
|
33
32
|
// no duplicate eliminated scans in the RHS!
|
34
33
|
// in this case we don't need to create a delim join
|
@@ -55,10 +55,8 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalExplain &o
|
|
55
55
|
collection->Append(chunk);
|
56
56
|
|
57
57
|
// create a chunk scan to output the result
|
58
|
-
auto chunk_scan =
|
59
|
-
|
60
|
-
chunk_scan->owned_collection = std::move(collection);
|
61
|
-
chunk_scan->collection = chunk_scan->owned_collection.get();
|
58
|
+
auto chunk_scan = make_uniq<PhysicalColumnDataScan>(op.types, PhysicalOperatorType::COLUMN_DATA_SCAN,
|
59
|
+
op.estimated_cardinality, std::move(collection));
|
62
60
|
return std::move(chunk_scan);
|
63
61
|
}
|
64
62
|
|
@@ -106,8 +106,8 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalInsert &op
|
|
106
106
|
D_ASSERT(op.children.size() == 1);
|
107
107
|
plan = CreatePlan(*op.children[0]);
|
108
108
|
}
|
109
|
-
dependencies.AddDependency(
|
110
|
-
return op.table
|
109
|
+
dependencies.AddDependency(op.table);
|
110
|
+
return op.table.catalog->PlanInsert(context, op, std::move(plan));
|
111
111
|
}
|
112
112
|
|
113
113
|
} // namespace duckdb
|
@@ -39,10 +39,8 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalShow &op)
|
|
39
39
|
collection->Append(append_state, output);
|
40
40
|
|
41
41
|
// create a chunk scan to output the result
|
42
|
-
auto chunk_scan =
|
43
|
-
|
44
|
-
chunk_scan->owned_collection = std::move(collection);
|
45
|
-
chunk_scan->collection = chunk_scan->owned_collection.get();
|
42
|
+
auto chunk_scan = make_uniq<PhysicalColumnDataScan>(op.types, PhysicalOperatorType::COLUMN_DATA_SCAN,
|
43
|
+
op.estimated_cardinality, std::move(collection));
|
46
44
|
return std::move(chunk_scan);
|
47
45
|
}
|
48
46
|
|
@@ -9,7 +9,7 @@ namespace duckdb {
|
|
9
9
|
unique_ptr<PhysicalOperator> DuckCatalog::PlanUpdate(ClientContext &context, LogicalUpdate &op,
|
10
10
|
unique_ptr<PhysicalOperator> plan) {
|
11
11
|
auto update =
|
12
|
-
make_uniq<PhysicalUpdate>(op.types,
|
12
|
+
make_uniq<PhysicalUpdate>(op.types, op.table, op.table.GetStorage(), op.columns, std::move(op.expressions),
|
13
13
|
std::move(op.bound_defaults), op.estimated_cardinality, op.return_chunk);
|
14
14
|
|
15
15
|
update->update_is_del_and_insert = op.update_is_del_and_insert;
|
@@ -22,8 +22,8 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalUpdate &op
|
|
22
22
|
|
23
23
|
auto plan = CreatePlan(*op.children[0]);
|
24
24
|
|
25
|
-
dependencies.AddDependency(
|
26
|
-
return op.table
|
25
|
+
dependencies.AddDependency(op.table);
|
26
|
+
return op.table.catalog->PlanUpdate(context, op, std::move(plan));
|
27
27
|
}
|
28
28
|
|
29
29
|
} // namespace duckdb
|
@@ -26,8 +26,8 @@ static DefaultCompressionMethod internal_compression_methods[] = {
|
|
26
26
|
{CompressionType::COMPRESSION_FSST, FSSTFun::GetFunction, FSSTFun::TypeIsSupported},
|
27
27
|
{CompressionType::COMPRESSION_AUTO, nullptr, nullptr}};
|
28
28
|
|
29
|
-
static CompressionFunction
|
30
|
-
|
29
|
+
static optional_ptr<CompressionFunction> FindCompressionFunction(CompressionFunctionSet &set, CompressionType type,
|
30
|
+
PhysicalType data_type) {
|
31
31
|
auto &functions = set.functions;
|
32
32
|
auto comp_entry = functions.find(type);
|
33
33
|
if (comp_entry != functions.end()) {
|
@@ -40,8 +40,8 @@ static CompressionFunction *FindCompressionFunction(CompressionFunctionSet &set,
|
|
40
40
|
return nullptr;
|
41
41
|
}
|
42
42
|
|
43
|
-
static CompressionFunction
|
44
|
-
|
43
|
+
static optional_ptr<CompressionFunction> LoadCompressionFunction(CompressionFunctionSet &set, CompressionType type,
|
44
|
+
PhysicalType data_type) {
|
45
45
|
for (idx_t index = 0; internal_compression_methods[index].get_function; index++) {
|
46
46
|
const auto &method = internal_compression_methods[index];
|
47
47
|
if (method.type == type) {
|
@@ -59,17 +59,17 @@ static CompressionFunction *LoadCompressionFunction(CompressionFunctionSet &set,
|
|
59
59
|
throw InternalException("Unsupported compression function type");
|
60
60
|
}
|
61
61
|
|
62
|
-
static void TryLoadCompression(DBConfig &config, vector<CompressionFunction
|
62
|
+
static void TryLoadCompression(DBConfig &config, vector<reference<CompressionFunction>> &result, CompressionType type,
|
63
63
|
PhysicalType data_type) {
|
64
64
|
auto function = config.GetCompressionFunction(type, data_type);
|
65
65
|
if (!function) {
|
66
66
|
return;
|
67
67
|
}
|
68
|
-
result.push_back(function);
|
68
|
+
result.push_back(*function);
|
69
69
|
}
|
70
70
|
|
71
|
-
vector<CompressionFunction
|
72
|
-
vector<CompressionFunction
|
71
|
+
vector<reference<CompressionFunction>> DBConfig::GetCompressionFunctions(PhysicalType data_type) {
|
72
|
+
vector<reference<CompressionFunction>> result;
|
73
73
|
TryLoadCompression(*this, result, CompressionType::COMPRESSION_UNCOMPRESSED, data_type);
|
74
74
|
TryLoadCompression(*this, result, CompressionType::COMPRESSION_RLE, data_type);
|
75
75
|
TryLoadCompression(*this, result, CompressionType::COMPRESSION_BITPACKING, data_type);
|
@@ -80,7 +80,7 @@ vector<CompressionFunction *> DBConfig::GetCompressionFunctions(PhysicalType dat
|
|
80
80
|
return result;
|
81
81
|
}
|
82
82
|
|
83
|
-
CompressionFunction
|
83
|
+
optional_ptr<CompressionFunction> DBConfig::GetCompressionFunction(CompressionType type, PhysicalType data_type) {
|
84
84
|
lock_guard<mutex> l(compression_functions->lock);
|
85
85
|
// check if the function is already loaded
|
86
86
|
auto function = FindCompressionFunction(*compression_functions, type, data_type);
|
@@ -670,7 +670,7 @@ static void StrfTimeFunctionDate(DataChunk &args, ExpressionState &state, Vector
|
|
670
670
|
}
|
671
671
|
|
672
672
|
void StrfTimeFormat::ConvertTimestampVector(Vector &input, Vector &result, idx_t count) {
|
673
|
-
D_ASSERT(input.GetType().id() == LogicalTypeId::TIMESTAMP);
|
673
|
+
D_ASSERT(input.GetType().id() == LogicalTypeId::TIMESTAMP || input.GetType().id() == LogicalTypeId::TIMESTAMP_TZ);
|
674
674
|
D_ASSERT(result.GetType().id() == LogicalTypeId::VARCHAR);
|
675
675
|
UnaryExecutor::ExecuteWithNulls<timestamp_t, string_t>(
|
676
676
|
input, result, count, [&](timestamp_t input, ValidityMask &mask, idx_t idx) {
|
@@ -325,6 +325,11 @@ static void WriteCSVSink(ExecutionContext &context, FunctionData &bind_data, Glo
|
|
325
325
|
// use the timestamp format to cast the chunk
|
326
326
|
csv_data.options.write_date_format[LogicalTypeId::TIMESTAMP].ConvertTimestampVector(
|
327
327
|
input.data[col_idx], cast_chunk.data[col_idx], input.size());
|
328
|
+
} else if (options.has_format[LogicalTypeId::TIMESTAMP_TZ] &&
|
329
|
+
csv_data.sql_types[col_idx].id() == LogicalTypeId::TIMESTAMP_TZ) {
|
330
|
+
// use the timestamp format to cast the chunk
|
331
|
+
csv_data.options.write_date_format[LogicalTypeId::TIMESTAMP_TZ].ConvertTimestampVector(
|
332
|
+
input.data[col_idx], cast_chunk.data[col_idx], input.size());
|
328
333
|
} else {
|
329
334
|
// non varchar column, perform the cast
|
330
335
|
VectorOperations::Cast(context.client, input.data[col_idx], cast_chunk.data[col_idx], input.size());
|
@@ -109,7 +109,7 @@ static void ExtractFunctions(ColumnDataCollection &collection, ExpressionInfo &i
|
|
109
109
|
static void PragmaDetailedProfilingOutputFunction(ClientContext &context, TableFunctionInput &data_p,
|
110
110
|
DataChunk &output) {
|
111
111
|
auto &state = data_p.global_state->Cast<PragmaDetailedProfilingOutputOperatorData>();
|
112
|
-
auto &data =
|
112
|
+
auto &data = data_p.bind_data->CastNoConst<PragmaDetailedProfilingOutputData>();
|
113
113
|
|
114
114
|
if (!state.initialized) {
|
115
115
|
// create a ColumnDataCollection
|
@@ -123,14 +123,15 @@ static void PragmaDetailedProfilingOutputFunction(ClientContext &context, TableF
|
|
123
123
|
int operator_counter = 1;
|
124
124
|
int function_counter = 1;
|
125
125
|
int expression_counter = 1;
|
126
|
-
|
126
|
+
auto &client_data = ClientData::Get(context);
|
127
|
+
if (client_data.query_profiler_history->GetPrevProfilers().empty()) {
|
127
128
|
return;
|
128
129
|
}
|
129
130
|
// For each Operator
|
130
|
-
|
131
|
-
|
131
|
+
auto &tree_map = client_data.query_profiler_history->GetPrevProfilers().back().second->GetTreeMap();
|
132
|
+
for (auto op : tree_map) {
|
132
133
|
// For each Expression Executor
|
133
|
-
for (auto &expr_executor : op.second
|
134
|
+
for (auto &expr_executor : op.second.get().info.executors_info) {
|
134
135
|
// For each Expression tree
|
135
136
|
if (!expr_executor) {
|
136
137
|
continue;
|
@@ -70,11 +70,13 @@ static void PragmaLastProfilingOutputFunction(ClientContext &context, TableFunct
|
|
70
70
|
DataChunk chunk;
|
71
71
|
chunk.Initialize(context, data.types);
|
72
72
|
int operator_counter = 1;
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
73
|
+
auto &client_data = ClientData::Get(context);
|
74
|
+
if (!client_data.query_profiler_history->GetPrevProfilers().empty()) {
|
75
|
+
auto &tree_map = client_data.query_profiler_history->GetPrevProfilers().back().second->GetTreeMap();
|
76
|
+
for (auto op : tree_map) {
|
77
|
+
auto &tree_info = op.second.get();
|
78
|
+
SetValue(chunk, chunk.size(), operator_counter++, tree_info.name, tree_info.info.time,
|
79
|
+
tree_info.info.elements, " ");
|
78
80
|
chunk.SetCardinality(chunk.size() + 1);
|
79
81
|
if (chunk.size() == STANDARD_VECTOR_SIZE) {
|
80
82
|
collection->Append(chunk);
|