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
@@ -41,21 +41,21 @@ string SanitizeExportIdentifier(const string &str) {
|
|
41
41
|
return result;
|
42
42
|
}
|
43
43
|
|
44
|
-
bool IsExistMainKeyTable(string &table_name, vector<TableCatalogEntry
|
44
|
+
bool IsExistMainKeyTable(string &table_name, vector<reference<TableCatalogEntry>> &unordered) {
|
45
45
|
for (idx_t i = 0; i < unordered.size(); i++) {
|
46
|
-
if (unordered[i]
|
46
|
+
if (unordered[i].get().name == table_name) {
|
47
47
|
return true;
|
48
48
|
}
|
49
49
|
}
|
50
50
|
return false;
|
51
51
|
}
|
52
52
|
|
53
|
-
void ScanForeignKeyTable(vector<TableCatalogEntry
|
53
|
+
void ScanForeignKeyTable(vector<reference<TableCatalogEntry>> &ordered, vector<reference<TableCatalogEntry>> &unordered,
|
54
54
|
bool move_only_pk_table) {
|
55
55
|
for (auto i = unordered.begin(); i != unordered.end();) {
|
56
56
|
auto table_entry = *i;
|
57
57
|
bool move_to_ordered = true;
|
58
|
-
auto &constraints = table_entry
|
58
|
+
auto &constraints = table_entry.get().GetConstraints();
|
59
59
|
for (idx_t j = 0; j < constraints.size(); j++) {
|
60
60
|
auto &cond = constraints[j];
|
61
61
|
if (cond->type == ConstraintType::FOREIGN_KEY) {
|
@@ -77,9 +77,9 @@ void ScanForeignKeyTable(vector<TableCatalogEntry *> &ordered, vector<TableCatal
|
|
77
77
|
}
|
78
78
|
}
|
79
79
|
|
80
|
-
void ReorderTableEntries(vector<TableCatalogEntry
|
81
|
-
vector<TableCatalogEntry
|
82
|
-
vector<TableCatalogEntry
|
80
|
+
void ReorderTableEntries(vector<reference<TableCatalogEntry>> &tables) {
|
81
|
+
vector<reference<TableCatalogEntry>> ordered;
|
82
|
+
vector<reference<TableCatalogEntry>> unordered = tables;
|
83
83
|
ScanForeignKeyTable(ordered, unordered, true);
|
84
84
|
while (!unordered.empty()) {
|
85
85
|
ScanForeignKeyTable(ordered, unordered, false);
|
@@ -87,12 +87,12 @@ void ReorderTableEntries(vector<TableCatalogEntry *> &tables) {
|
|
87
87
|
tables = ordered;
|
88
88
|
}
|
89
89
|
|
90
|
-
string CreateFileName(const string &id_suffix, TableCatalogEntry
|
91
|
-
auto name = SanitizeExportIdentifier(table
|
92
|
-
if (table
|
90
|
+
string CreateFileName(const string &id_suffix, TableCatalogEntry &table, const string &extension) {
|
91
|
+
auto name = SanitizeExportIdentifier(table.name);
|
92
|
+
if (table.schema->name == DEFAULT_SCHEMA) {
|
93
93
|
return StringUtil::Format("%s%s.%s", name, id_suffix, extension);
|
94
94
|
}
|
95
|
-
auto schema = SanitizeExportIdentifier(table
|
95
|
+
auto schema = SanitizeExportIdentifier(table.schema->name);
|
96
96
|
return StringUtil::Format("%s_%s%s.%s", schema, name, id_suffix, extension);
|
97
97
|
}
|
98
98
|
|
@@ -115,12 +115,12 @@ BoundStatement Binder::Bind(ExportStatement &stmt) {
|
|
115
115
|
|
116
116
|
// gather a list of all the tables
|
117
117
|
string catalog = stmt.database.empty() ? INVALID_CATALOG : stmt.database;
|
118
|
-
vector<TableCatalogEntry
|
118
|
+
vector<reference<TableCatalogEntry>> tables;
|
119
119
|
auto schemas = Catalog::GetSchemas(context, catalog);
|
120
120
|
for (auto &schema : schemas) {
|
121
121
|
schema->Scan(context, CatalogType::TABLE_ENTRY, [&](CatalogEntry *entry) {
|
122
122
|
if (entry->type == CatalogType::TABLE_ENTRY) {
|
123
|
-
tables.push_back((
|
123
|
+
tables.push_back(entry->Cast<TableCatalogEntry>());
|
124
124
|
}
|
125
125
|
});
|
126
126
|
}
|
@@ -135,14 +135,14 @@ BoundStatement Binder::Bind(ExportStatement &stmt) {
|
|
135
135
|
BoundExportData exported_tables;
|
136
136
|
|
137
137
|
unordered_set<string> table_name_index;
|
138
|
-
for (auto &
|
138
|
+
for (auto &t : tables) {
|
139
|
+
auto &table = t.get();
|
139
140
|
auto info = make_uniq<CopyInfo>();
|
140
141
|
// we copy the options supplied to the EXPORT
|
141
142
|
info->format = stmt.info->format;
|
142
143
|
info->options = stmt.info->options;
|
143
144
|
// set up the file name for the COPY TO
|
144
145
|
|
145
|
-
auto exported_data = ExportedTableData();
|
146
146
|
idx_t id = 0;
|
147
147
|
while (true) {
|
148
148
|
string id_suffix = id == 0 ? string() : "_" + to_string(id);
|
@@ -159,23 +159,22 @@ BoundStatement Binder::Bind(ExportStatement &stmt) {
|
|
159
159
|
}
|
160
160
|
info->is_from = false;
|
161
161
|
info->catalog = catalog;
|
162
|
-
info->schema = table
|
163
|
-
info->table = table
|
162
|
+
info->schema = table.schema->name;
|
163
|
+
info->table = table.name;
|
164
164
|
|
165
165
|
// We can not export generated columns
|
166
|
-
for (auto &col : table
|
166
|
+
for (auto &col : table.GetColumns().Physical()) {
|
167
167
|
info->select_list.push_back(col.GetName());
|
168
168
|
}
|
169
169
|
|
170
|
+
ExportedTableData exported_data;
|
170
171
|
exported_data.database_name = catalog;
|
171
172
|
exported_data.table_name = info->table;
|
172
173
|
exported_data.schema_name = info->schema;
|
173
174
|
|
174
175
|
exported_data.file_path = info->file_path;
|
175
176
|
|
176
|
-
ExportedTableInfo table_info;
|
177
|
-
table_info.entry = table;
|
178
|
-
table_info.table_data = exported_data;
|
177
|
+
ExportedTableInfo table_info(table, std::move(exported_data));
|
179
178
|
exported_tables.data.push_back(table_info);
|
180
179
|
id++;
|
181
180
|
|
@@ -21,9 +21,10 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
|
|
21
21
|
QueryErrorContext error_context(root_statement, ref.query_location);
|
22
22
|
// CTEs and views are also referred to using BaseTableRefs, hence need to distinguish here
|
23
23
|
// check if the table name refers to a CTE
|
24
|
-
auto
|
25
|
-
if (
|
24
|
+
auto found_cte = FindCTE(ref.table_name, ref.table_name == alias);
|
25
|
+
if (found_cte) {
|
26
26
|
// Check if there is a CTE binding in the BindContext
|
27
|
+
auto &cte = *found_cte;
|
27
28
|
auto ctebinding = bind_context.GetCTEBinding(ref.table_name);
|
28
29
|
if (!ctebinding) {
|
29
30
|
if (CTEIsAlreadyBound(cte)) {
|
@@ -31,9 +32,9 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
|
|
31
32
|
ref.table_name);
|
32
33
|
}
|
33
34
|
// Move CTE to subquery and bind recursively
|
34
|
-
SubqueryRef subquery(unique_ptr_cast<SQLStatement, SelectStatement>(cte
|
35
|
+
SubqueryRef subquery(unique_ptr_cast<SQLStatement, SelectStatement>(cte.query->Copy()));
|
35
36
|
subquery.alias = ref.alias.empty() ? ref.table_name : ref.alias;
|
36
|
-
subquery.column_name_alias = cte
|
37
|
+
subquery.column_name_alias = cte.aliases;
|
37
38
|
for (idx_t i = 0; i < ref.column_name_alias.size(); i++) {
|
38
39
|
if (i < subquery.column_name_alias.size()) {
|
39
40
|
subquery.column_name_alias[i] = ref.column_name_alias[i];
|
@@ -41,7 +42,7 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
|
|
41
42
|
subquery.column_name_alias.push_back(ref.column_name_alias[i]);
|
42
43
|
}
|
43
44
|
}
|
44
|
-
return Bind(subquery,
|
45
|
+
return Bind(subquery, found_cte);
|
45
46
|
} else {
|
46
47
|
// There is a CTE binding in the BindContext.
|
47
48
|
// This can only be the case if there is a recursive CTE present.
|
@@ -66,6 +67,21 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
|
|
66
67
|
BindSchemaOrCatalog(ref.catalog_name, ref.schema_name);
|
67
68
|
auto table_or_view = Catalog::GetEntry(context, CatalogType::TABLE_ENTRY, ref.catalog_name, ref.schema_name,
|
68
69
|
ref.table_name, true, error_context);
|
70
|
+
// we still didn't find the table
|
71
|
+
if (GetBindingMode() == BindingMode::EXTRACT_NAMES) {
|
72
|
+
if (!table_or_view || table_or_view->type == CatalogType::TABLE_ENTRY) {
|
73
|
+
// if we are in EXTRACT_NAMES, we create a dummy table ref
|
74
|
+
AddTableName(ref.table_name);
|
75
|
+
|
76
|
+
// add a bind context entry
|
77
|
+
auto table_index = GenerateTableIndex();
|
78
|
+
auto alias = ref.alias.empty() ? ref.table_name : ref.alias;
|
79
|
+
vector<LogicalType> types {LogicalType::INTEGER};
|
80
|
+
vector<string> names {"__dummy_col" + to_string(table_index)};
|
81
|
+
bind_context.AddGenericBinding(table_index, alias, names, types);
|
82
|
+
return make_uniq_base<BoundTableRef, BoundEmptyTableRef>(table_index);
|
83
|
+
}
|
84
|
+
}
|
69
85
|
if (!table_or_view) {
|
70
86
|
string table_name = ref.catalog_name;
|
71
87
|
if (!ref.schema_name.empty()) {
|
@@ -82,7 +98,6 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
|
|
82
98
|
if (replacement_function->type == TableReferenceType::TABLE_FUNCTION) {
|
83
99
|
auto &table_function = replacement_function->Cast<TableFunctionRef>();
|
84
100
|
table_function.column_name_alias = ref.column_name_alias;
|
85
|
-
;
|
86
101
|
} else if (replacement_function->type == TableReferenceType::SUBQUERY) {
|
87
102
|
auto &subquery = replacement_function->Cast<SubqueryRef>();
|
88
103
|
subquery.column_name_alias = ref.column_name_alias;
|
@@ -94,19 +109,6 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
|
|
94
109
|
}
|
95
110
|
}
|
96
111
|
|
97
|
-
// we still didn't find the table
|
98
|
-
if (GetBindingMode() == BindingMode::EXTRACT_NAMES) {
|
99
|
-
// if we are in EXTRACT_NAMES, we create a dummy table ref
|
100
|
-
AddTableName(table_name);
|
101
|
-
|
102
|
-
// add a bind context entry
|
103
|
-
auto table_index = GenerateTableIndex();
|
104
|
-
auto alias = ref.alias.empty() ? table_name : ref.alias;
|
105
|
-
vector<LogicalType> types {LogicalType::INTEGER};
|
106
|
-
vector<string> names {"__dummy_col" + to_string(table_index)};
|
107
|
-
bind_context.AddGenericBinding(table_index, alias, names, types);
|
108
|
-
return make_uniq_base<BoundTableRef, BoundEmptyTableRef>(table_index);
|
109
|
-
}
|
110
112
|
// could not find an alternative: bind again to get the error
|
111
113
|
table_or_view = Catalog::GetEntry(context, CatalogType::TABLE_ENTRY, ref.catalog_name, ref.schema_name,
|
112
114
|
ref.table_name, false, error_context);
|
@@ -155,7 +157,7 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
|
|
155
157
|
subquery.column_name_alias =
|
156
158
|
BindContext::AliasColumnNames(subquery.alias, view_catalog_entry->aliases, ref.column_name_alias);
|
157
159
|
// bind the child subquery
|
158
|
-
view_binder->AddBoundView(view_catalog_entry);
|
160
|
+
view_binder->AddBoundView(*view_catalog_entry);
|
159
161
|
auto bound_child = view_binder->Bind(subquery);
|
160
162
|
if (!view_binder->correlated_columns.empty()) {
|
161
163
|
throw BinderException("Contents of view were altered - view bound correlated columns");
|
@@ -164,8 +166,8 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
|
|
164
166
|
D_ASSERT(bound_child->type == TableReferenceType::SUBQUERY);
|
165
167
|
// verify that the types and names match up with the expected types and names
|
166
168
|
auto &bound_subquery = bound_child->Cast<BoundSubqueryRef>();
|
167
|
-
|
168
|
-
|
169
|
+
if (GetBindingMode() != BindingMode::EXTRACT_NAMES &&
|
170
|
+
bound_subquery.subquery->types != view_catalog_entry->types) {
|
169
171
|
throw BinderException("Contents of view were altered: types don't match!");
|
170
172
|
}
|
171
173
|
bind_context.AddView(bound_subquery.subquery->GetRootIndex(), subquery.alias, subquery,
|
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
namespace duckdb {
|
6
6
|
|
7
|
-
unique_ptr<BoundTableRef> Binder::Bind(SubqueryRef &ref, CommonTableExpressionInfo
|
7
|
+
unique_ptr<BoundTableRef> Binder::Bind(SubqueryRef &ref, optional_ptr<CommonTableExpressionInfo> cte) {
|
8
8
|
auto binder = Binder::CreateBinder(context, this);
|
9
9
|
binder->can_contain_nulls = true;
|
10
10
|
if (cte) {
|
11
|
-
binder->bound_ctes.insert(cte);
|
11
|
+
binder->bound_ctes.insert(*cte);
|
12
12
|
}
|
13
13
|
binder->alias = ref.alias.empty() ? "unnamed_subquery" : ref.alias;
|
14
14
|
auto subquery = binder->BindNode(*ref.subquery->node);
|
@@ -19,6 +19,7 @@
|
|
19
19
|
#include "duckdb/function/function_binder.hpp"
|
20
20
|
#include "duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp"
|
21
21
|
#include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
|
22
|
+
#include "duckdb/function/table/read_csv.hpp"
|
22
23
|
|
23
24
|
namespace duckdb {
|
24
25
|
|
@@ -143,6 +144,14 @@ Binder::BindTableFunctionInternal(TableFunction &table_function, const string &f
|
|
143
144
|
auto arrow_bind = (PyTableFunctionData *)bind_data.get();
|
144
145
|
arrow_bind->external_dependency = std::move(external_dependency);
|
145
146
|
}
|
147
|
+
if (table_function.name == "read_csv" || table_function.name == "read_csv_auto") {
|
148
|
+
auto &csv_bind = bind_data->Cast<ReadCSVData>();
|
149
|
+
if (csv_bind.single_threaded) {
|
150
|
+
table_function.extra_info = "(Single-Threaded)";
|
151
|
+
} else {
|
152
|
+
table_function.extra_info = "(Multi-Threaded)";
|
153
|
+
}
|
154
|
+
}
|
146
155
|
}
|
147
156
|
if (return_types.size() != return_names.size()) {
|
148
157
|
throw InternalException(
|
@@ -21,13 +21,12 @@
|
|
21
21
|
|
22
22
|
namespace duckdb {
|
23
23
|
|
24
|
-
shared_ptr<Binder> Binder::CreateBinder(ClientContext &context, Binder
|
24
|
+
shared_ptr<Binder> Binder::CreateBinder(ClientContext &context, optional_ptr<Binder> parent, bool inherit_ctes) {
|
25
25
|
return make_shared<Binder>(true, context, parent ? parent->shared_from_this() : nullptr, inherit_ctes);
|
26
26
|
}
|
27
27
|
|
28
28
|
Binder::Binder(bool, ClientContext &context, shared_ptr<Binder> parent_p, bool inherit_ctes_p)
|
29
29
|
: context(context), parent(std::move(parent_p)), bound_tables(0), inherit_ctes(inherit_ctes_p) {
|
30
|
-
parameters = nullptr;
|
31
30
|
if (parent) {
|
32
31
|
|
33
32
|
// We have to inherit macro and lambda parameter bindings and from the parent binder, if there is a parent.
|
@@ -102,7 +101,7 @@ BoundStatement Binder::Bind(SQLStatement &statement) {
|
|
102
101
|
|
103
102
|
void Binder::AddCTEMap(CommonTableExpressionMap &cte_map) {
|
104
103
|
for (auto &cte_it : cte_map.map) {
|
105
|
-
AddCTE(cte_it.first, cte_it.second
|
104
|
+
AddCTE(cte_it.first, *cte_it.second);
|
106
105
|
}
|
107
106
|
}
|
108
107
|
|
@@ -222,21 +221,20 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundTableRef &ref) {
|
|
222
221
|
return root;
|
223
222
|
}
|
224
223
|
|
225
|
-
void Binder::AddCTE(const string &name, CommonTableExpressionInfo
|
226
|
-
D_ASSERT(info);
|
224
|
+
void Binder::AddCTE(const string &name, CommonTableExpressionInfo &info) {
|
227
225
|
D_ASSERT(!name.empty());
|
228
226
|
auto entry = CTE_bindings.find(name);
|
229
227
|
if (entry != CTE_bindings.end()) {
|
230
228
|
throw InternalException("Duplicate CTE \"%s\" in query!", name);
|
231
229
|
}
|
232
|
-
CTE_bindings
|
230
|
+
CTE_bindings.insert(make_pair(name, reference<CommonTableExpressionInfo>(info)));
|
233
231
|
}
|
234
232
|
|
235
|
-
CommonTableExpressionInfo
|
233
|
+
optional_ptr<CommonTableExpressionInfo> Binder::FindCTE(const string &name, bool skip) {
|
236
234
|
auto entry = CTE_bindings.find(name);
|
237
235
|
if (entry != CTE_bindings.end()) {
|
238
|
-
if (!skip || entry->second
|
239
|
-
return entry->second;
|
236
|
+
if (!skip || entry->second.get().query->node->type == QueryNodeType::RECURSIVE_CTE_NODE) {
|
237
|
+
return &entry->second.get();
|
240
238
|
}
|
241
239
|
}
|
242
240
|
if (parent && inherit_ctes) {
|
@@ -245,7 +243,7 @@ CommonTableExpressionInfo *Binder::FindCTE(const string &name, bool skip) {
|
|
245
243
|
return nullptr;
|
246
244
|
}
|
247
245
|
|
248
|
-
bool Binder::CTEIsAlreadyBound(CommonTableExpressionInfo
|
246
|
+
bool Binder::CTEIsAlreadyBound(CommonTableExpressionInfo &cte) {
|
249
247
|
if (bound_ctes.find(cte) != bound_ctes.end()) {
|
250
248
|
return true;
|
251
249
|
}
|
@@ -255,13 +253,12 @@ bool Binder::CTEIsAlreadyBound(CommonTableExpressionInfo *cte) {
|
|
255
253
|
return false;
|
256
254
|
}
|
257
255
|
|
258
|
-
void Binder::AddBoundView(ViewCatalogEntry
|
256
|
+
void Binder::AddBoundView(ViewCatalogEntry &view) {
|
259
257
|
// check if the view is already bound
|
260
258
|
auto current = this;
|
261
259
|
while (current) {
|
262
260
|
if (current->bound_views.find(view) != current->bound_views.end()) {
|
263
|
-
throw BinderException("infinite recursion detected: attempting to recursively bind view \"%s\"",
|
264
|
-
view->name);
|
261
|
+
throw BinderException("infinite recursion detected: attempting to recursively bind view \"%s\"", view.name);
|
265
262
|
}
|
266
263
|
current = current->parent.get();
|
267
264
|
}
|
@@ -276,7 +273,7 @@ idx_t Binder::GenerateTableIndex() {
|
|
276
273
|
return bound_tables++;
|
277
274
|
}
|
278
275
|
|
279
|
-
void Binder::PushExpressionBinder(ExpressionBinder
|
276
|
+
void Binder::PushExpressionBinder(ExpressionBinder &binder) {
|
280
277
|
GetActiveBinders().push_back(binder);
|
281
278
|
}
|
282
279
|
|
@@ -285,12 +282,12 @@ void Binder::PopExpressionBinder() {
|
|
285
282
|
GetActiveBinders().pop_back();
|
286
283
|
}
|
287
284
|
|
288
|
-
void Binder::SetActiveBinder(ExpressionBinder
|
285
|
+
void Binder::SetActiveBinder(ExpressionBinder &binder) {
|
289
286
|
D_ASSERT(HasActiveBinder());
|
290
287
|
GetActiveBinders().back() = binder;
|
291
288
|
}
|
292
289
|
|
293
|
-
ExpressionBinder
|
290
|
+
ExpressionBinder &Binder::GetActiveBinder() {
|
294
291
|
return GetActiveBinders().back();
|
295
292
|
}
|
296
293
|
|
@@ -298,7 +295,7 @@ bool Binder::HasActiveBinder() {
|
|
298
295
|
return !GetActiveBinders().empty();
|
299
296
|
}
|
300
297
|
|
301
|
-
vector<ExpressionBinder
|
298
|
+
vector<reference<ExpressionBinder>> &Binder::GetActiveBinders() {
|
302
299
|
if (parent) {
|
303
300
|
return parent->GetActiveBinders();
|
304
301
|
}
|
@@ -344,10 +341,10 @@ bool Binder::HasMatchingBinding(const string &schema_name, const string &table_n
|
|
344
341
|
|
345
342
|
bool Binder::HasMatchingBinding(const string &catalog_name, const string &schema_name, const string &table_name,
|
346
343
|
const string &column_name, string &error_message) {
|
347
|
-
Binding
|
344
|
+
optional_ptr<Binding> binding;
|
348
345
|
D_ASSERT(!lambda_bindings);
|
349
346
|
if (macro_binding && table_name == macro_binding->alias) {
|
350
|
-
binding = macro_binding;
|
347
|
+
binding = optional_ptr<Binding>(macro_binding.get());
|
351
348
|
} else {
|
352
349
|
binding = bind_context.GetBinding(table_name, error_message);
|
353
350
|
}
|
@@ -9,19 +9,19 @@
|
|
9
9
|
namespace duckdb {
|
10
10
|
|
11
11
|
ExpressionBinder::ExpressionBinder(Binder &binder, ClientContext &context, bool replace_binder)
|
12
|
-
: binder(binder), context(context)
|
12
|
+
: binder(binder), context(context) {
|
13
13
|
if (replace_binder) {
|
14
|
-
stored_binder = binder.GetActiveBinder();
|
15
|
-
binder.SetActiveBinder(this);
|
14
|
+
stored_binder = &binder.GetActiveBinder();
|
15
|
+
binder.SetActiveBinder(*this);
|
16
16
|
} else {
|
17
|
-
binder.PushExpressionBinder(this);
|
17
|
+
binder.PushExpressionBinder(*this);
|
18
18
|
}
|
19
19
|
}
|
20
20
|
|
21
21
|
ExpressionBinder::~ExpressionBinder() {
|
22
22
|
if (binder.HasActiveBinder()) {
|
23
23
|
if (stored_binder) {
|
24
|
-
binder.SetActiveBinder(stored_binder);
|
24
|
+
binder.SetActiveBinder(*stored_binder);
|
25
25
|
} else {
|
26
26
|
binder.PopExpressionBinder();
|
27
27
|
}
|
@@ -82,9 +82,9 @@ bool ExpressionBinder::BindCorrelatedColumns(unique_ptr<ParsedExpression> &expr)
|
|
82
82
|
idx_t depth = 1;
|
83
83
|
bool success = false;
|
84
84
|
while (!active_binders.empty()) {
|
85
|
-
auto &next_binder = active_binders.back();
|
86
|
-
ExpressionBinder::QualifyColumnNames(next_binder
|
87
|
-
auto bind_result = next_binder
|
85
|
+
auto &next_binder = active_binders.back().get();
|
86
|
+
ExpressionBinder::QualifyColumnNames(next_binder.binder, expr);
|
87
|
+
auto bind_result = next_binder.Bind(&expr, depth);
|
88
88
|
if (bind_result.empty()) {
|
89
89
|
success = true;
|
90
90
|
break;
|
@@ -11,7 +11,7 @@ namespace duckdb {
|
|
11
11
|
void LogicalCopyToFile::Serialize(FieldWriter &writer) const {
|
12
12
|
writer.WriteString(file_path);
|
13
13
|
writer.WriteField(use_tmp_file);
|
14
|
-
writer.WriteField(
|
14
|
+
writer.WriteField(overwrite_or_ignore);
|
15
15
|
writer.WriteField(per_thread_output);
|
16
16
|
writer.WriteList<idx_t>(partition_columns);
|
17
17
|
|
@@ -29,7 +29,7 @@ void LogicalCopyToFile::Serialize(FieldWriter &writer) const {
|
|
29
29
|
unique_ptr<LogicalOperator> LogicalCopyToFile::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
|
30
30
|
auto file_path = reader.ReadRequired<string>();
|
31
31
|
auto use_tmp_file = reader.ReadRequired<bool>();
|
32
|
-
auto
|
32
|
+
auto overwrite_or_ignore = reader.ReadRequired<bool>();
|
33
33
|
auto per_thread_output = reader.ReadRequired<bool>();
|
34
34
|
auto partition_columns = reader.ReadRequiredList<idx_t>();
|
35
35
|
|
@@ -56,7 +56,7 @@ unique_ptr<LogicalOperator> LogicalCopyToFile::Deserialize(LogicalDeserializatio
|
|
56
56
|
auto result = make_uniq<LogicalCopyToFile>(copy_func, std::move(bind_data));
|
57
57
|
result->file_path = file_path;
|
58
58
|
result->use_tmp_file = use_tmp_file;
|
59
|
-
result->
|
59
|
+
result->overwrite_or_ignore = overwrite_or_ignore;
|
60
60
|
result->per_thread_output = per_thread_output;
|
61
61
|
result->partition_columns = std::move(partition_columns);
|
62
62
|
return std::move(result);
|
@@ -34,7 +34,7 @@
|
|
34
34
|
|
35
35
|
namespace duckdb {
|
36
36
|
|
37
|
-
void ReorderTableEntries(vector<TableCatalogEntry
|
37
|
+
void ReorderTableEntries(vector<reference<TableCatalogEntry>> &tables);
|
38
38
|
|
39
39
|
SingleFileCheckpointWriter::SingleFileCheckpointWriter(AttachedDatabase &db, BlockManager &block_manager)
|
40
40
|
: CheckpointWriter(db), partial_block_manager(block_manager) {
|
@@ -148,60 +148,60 @@ void CheckpointWriter::WriteSchema(SchemaCatalogEntry &schema) {
|
|
148
148
|
// write the schema data
|
149
149
|
schema.Serialize(GetMetaBlockWriter());
|
150
150
|
// then, we fetch the tables/views/sequences information
|
151
|
-
vector<TableCatalogEntry
|
152
|
-
vector<ViewCatalogEntry
|
151
|
+
vector<reference<TableCatalogEntry>> tables;
|
152
|
+
vector<reference<ViewCatalogEntry>> views;
|
153
153
|
schema.Scan(CatalogType::TABLE_ENTRY, [&](CatalogEntry *entry) {
|
154
154
|
if (entry->internal) {
|
155
155
|
return;
|
156
156
|
}
|
157
157
|
if (entry->type == CatalogType::TABLE_ENTRY) {
|
158
|
-
tables.push_back((
|
158
|
+
tables.push_back(entry->Cast<TableCatalogEntry>());
|
159
159
|
} else if (entry->type == CatalogType::VIEW_ENTRY) {
|
160
|
-
views.push_back((
|
160
|
+
views.push_back(entry->Cast<ViewCatalogEntry>());
|
161
161
|
} else {
|
162
162
|
throw NotImplementedException("Catalog type for entries");
|
163
163
|
}
|
164
164
|
});
|
165
|
-
vector<SequenceCatalogEntry
|
165
|
+
vector<reference<SequenceCatalogEntry>> sequences;
|
166
166
|
schema.Scan(CatalogType::SEQUENCE_ENTRY, [&](CatalogEntry *entry) {
|
167
167
|
if (entry->internal) {
|
168
168
|
return;
|
169
169
|
}
|
170
|
-
sequences.push_back((
|
170
|
+
sequences.push_back(entry->Cast<SequenceCatalogEntry>());
|
171
171
|
});
|
172
172
|
|
173
|
-
vector<TypeCatalogEntry
|
173
|
+
vector<reference<TypeCatalogEntry>> custom_types;
|
174
174
|
schema.Scan(CatalogType::TYPE_ENTRY, [&](CatalogEntry *entry) {
|
175
175
|
if (entry->internal) {
|
176
176
|
return;
|
177
177
|
}
|
178
|
-
custom_types.push_back((
|
178
|
+
custom_types.push_back(entry->Cast<TypeCatalogEntry>());
|
179
179
|
});
|
180
180
|
|
181
|
-
vector<ScalarMacroCatalogEntry
|
181
|
+
vector<reference<ScalarMacroCatalogEntry>> macros;
|
182
182
|
schema.Scan(CatalogType::SCALAR_FUNCTION_ENTRY, [&](CatalogEntry *entry) {
|
183
183
|
if (entry->internal) {
|
184
184
|
return;
|
185
185
|
}
|
186
186
|
if (entry->type == CatalogType::MACRO_ENTRY) {
|
187
|
-
macros.push_back((
|
187
|
+
macros.push_back(entry->Cast<ScalarMacroCatalogEntry>());
|
188
188
|
}
|
189
189
|
});
|
190
190
|
|
191
|
-
vector<TableMacroCatalogEntry
|
191
|
+
vector<reference<TableMacroCatalogEntry>> table_macros;
|
192
192
|
schema.Scan(CatalogType::TABLE_FUNCTION_ENTRY, [&](CatalogEntry *entry) {
|
193
193
|
if (entry->internal) {
|
194
194
|
return;
|
195
195
|
}
|
196
196
|
if (entry->type == CatalogType::TABLE_MACRO_ENTRY) {
|
197
|
-
table_macros.push_back((
|
197
|
+
table_macros.push_back(entry->Cast<TableMacroCatalogEntry>());
|
198
198
|
}
|
199
199
|
});
|
200
200
|
|
201
|
-
vector<IndexCatalogEntry
|
201
|
+
vector<reference<IndexCatalogEntry>> indexes;
|
202
202
|
schema.Scan(CatalogType::INDEX_ENTRY, [&](CatalogEntry *entry) {
|
203
203
|
D_ASSERT(!entry->internal);
|
204
|
-
indexes.push_back((
|
204
|
+
indexes.push_back(entry->Cast<IndexCatalogEntry>());
|
205
205
|
});
|
206
206
|
|
207
207
|
FieldWriter writer(GetMetaBlockWriter());
|
@@ -216,36 +216,36 @@ void CheckpointWriter::WriteSchema(SchemaCatalogEntry &schema) {
|
|
216
216
|
|
217
217
|
// write the custom_types
|
218
218
|
for (auto &custom_type : custom_types) {
|
219
|
-
WriteType(
|
219
|
+
WriteType(custom_type);
|
220
220
|
}
|
221
221
|
|
222
222
|
// write the sequences
|
223
223
|
for (auto &seq : sequences) {
|
224
|
-
WriteSequence(
|
224
|
+
WriteSequence(seq);
|
225
225
|
}
|
226
226
|
// reorder tables because of foreign key constraint
|
227
227
|
ReorderTableEntries(tables);
|
228
228
|
// Write the tables
|
229
229
|
for (auto &table : tables) {
|
230
|
-
WriteTable(
|
230
|
+
WriteTable(table);
|
231
231
|
}
|
232
232
|
// Write the views
|
233
233
|
for (auto &view : views) {
|
234
|
-
WriteView(
|
234
|
+
WriteView(view);
|
235
235
|
}
|
236
236
|
|
237
237
|
// Write the macros
|
238
238
|
for (auto ¯o : macros) {
|
239
|
-
WriteMacro(
|
239
|
+
WriteMacro(macro);
|
240
240
|
}
|
241
241
|
|
242
242
|
// Write the table's macros
|
243
243
|
for (auto ¯o : table_macros) {
|
244
|
-
WriteTableMacro(
|
244
|
+
WriteTableMacro(macro);
|
245
245
|
}
|
246
246
|
// Write the indexes
|
247
247
|
for (auto &index : indexes) {
|
248
|
-
WriteIndex(
|
248
|
+
WriteIndex(index);
|
249
249
|
}
|
250
250
|
}
|
251
251
|
|
@@ -448,7 +448,7 @@ void CheckpointReader::ReadTable(ClientContext &context, MetaBlockReader &reader
|
|
448
448
|
// bind the info
|
449
449
|
auto binder = Binder::CreateBinder(context);
|
450
450
|
auto schema = catalog.GetSchema(context, info->schema);
|
451
|
-
auto bound_info = binder->BindCreateTableInfo(std::move(info), schema);
|
451
|
+
auto bound_info = binder->BindCreateTableInfo(std::move(info), *schema);
|
452
452
|
|
453
453
|
// now read the actual table data and place it into the create table info
|
454
454
|
ReadTableData(context, reader, *bound_info);
|
@@ -208,7 +208,7 @@ void StandardBufferManager::VerifyZeroReaders(shared_ptr<BlockHandle> &handle) {
|
|
208
208
|
auto replacement_buffer = make_uniq<FileBuffer>(Allocator::Get(db), handle->buffer->type,
|
209
209
|
handle->memory_usage - Storage::BLOCK_HEADER_SIZE);
|
210
210
|
memcpy(replacement_buffer->buffer, handle->buffer->buffer, handle->buffer->size);
|
211
|
-
memset(handle->buffer->buffer,
|
211
|
+
memset(handle->buffer->buffer, 0xa5, handle->buffer->size); // 0xa5 is default memory in debug mode
|
212
212
|
handle->buffer = std::move(replacement_buffer);
|
213
213
|
#endif
|
214
214
|
}
|
@@ -9,13 +9,13 @@ void TableIndexList::AddIndex(unique_ptr<Index> index) {
|
|
9
9
|
lock_guard<mutex> lock(indexes_lock);
|
10
10
|
indexes.push_back(std::move(index));
|
11
11
|
}
|
12
|
-
|
13
|
-
|
12
|
+
|
13
|
+
void TableIndexList::RemoveIndex(Index &index) {
|
14
14
|
lock_guard<mutex> lock(indexes_lock);
|
15
15
|
|
16
16
|
for (idx_t index_idx = 0; index_idx < indexes.size(); index_idx++) {
|
17
17
|
auto &index_entry = indexes[index_idx];
|
18
|
-
if (index_entry.get() == index) {
|
18
|
+
if (index_entry.get() == &index) {
|
19
19
|
indexes.erase(indexes.begin() + index_idx);
|
20
20
|
break;
|
21
21
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#include "duckdb/verification/statement_verifier.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/common/preserved_error.hpp"
|
4
|
-
#include "duckdb/common/types/column_data_collection.hpp"
|
4
|
+
#include "duckdb/common/types/column/column_data_collection.hpp"
|
5
5
|
#include "duckdb/parser/parser.hpp"
|
6
6
|
#include "duckdb/verification/copied_statement_verifier.hpp"
|
7
7
|
#include "duckdb/verification/deserialized_statement_verifier.hpp"
|