duckdb 0.8.2-dev4871.0 → 0.8.2-dev5080.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/package.json +1 -1
- package/src/duckdb/extension/icu/icu-strptime.cpp +1 -0
- package/src/duckdb/extension/json/json_functions/copy_json.cpp +1 -1
- package/src/duckdb/src/common/enum_util.cpp +5 -0
- package/src/duckdb/src/common/operator/cast_operators.cpp +18 -0
- package/src/duckdb/src/common/row_operations/row_matcher.cpp +5 -38
- package/src/duckdb/src/common/types/data_chunk.cpp +47 -10
- package/src/duckdb/src/common/types/vector.cpp +0 -1
- package/src/duckdb/src/common/types.cpp +10 -1
- package/src/duckdb/src/core_functions/scalar/date/strftime.cpp +2 -2
- package/src/duckdb/src/core_functions/scalar/list/array_slice.cpp +18 -8
- package/src/duckdb/src/core_functions/scalar/list/list_sort.cpp +10 -1
- package/src/duckdb/src/core_functions/scalar/map/map_concat.cpp +0 -2
- package/src/duckdb/src/core_functions/scalar/struct/struct_pack.cpp +12 -6
- package/src/duckdb/src/execution/nested_loop_join/nested_loop_join_inner.cpp +20 -27
- package/src/duckdb/src/execution/nested_loop_join/nested_loop_join_mark.cpp +21 -9
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +7 -7
- package/src/duckdb/src/execution/operator/csv_scanner/csv_reader_options.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/parallel_csv_reader.cpp +0 -2
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +14 -2
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +13 -8
- package/src/duckdb/src/function/cast/struct_cast.cpp +8 -0
- package/src/duckdb/src/function/cast/time_casts.cpp +12 -0
- package/src/duckdb/src/function/cast/union_casts.cpp +5 -0
- package/src/duckdb/src/function/function_binder.cpp +11 -2
- package/src/duckdb/src/function/pragma/pragma_functions.cpp +5 -0
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +3 -0
- package/src/duckdb/src/function/scalar/strftime_format.cpp +29 -8
- package/src/duckdb/src/function/table/arrow.cpp +4 -0
- package/src/duckdb/src/function/table/copy_csv.cpp +2 -1
- package/src/duckdb/src/function/table/read_csv.cpp +4 -1
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +5 -0
- package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +27 -0
- package/src/duckdb/src/include/duckdb/common/operator/comparison_operators.hpp +38 -2
- package/src/duckdb/src/include/duckdb/common/types.hpp +1 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/bit_functions.hpp +4 -4
- package/src/duckdb/src/include/duckdb/core_functions/scalar/blob_functions.hpp +4 -4
- package/src/duckdb/src/include/duckdb/core_functions/scalar/date_functions.hpp +5 -5
- package/src/duckdb/src/include/duckdb/core_functions/scalar/enum_functions.hpp +7 -7
- package/src/duckdb/src/include/duckdb/core_functions/scalar/generic_functions.hpp +12 -12
- package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +12 -12
- package/src/duckdb/src/include/duckdb/core_functions/scalar/map_functions.hpp +3 -3
- package/src/duckdb/src/include/duckdb/core_functions/scalar/math_functions.hpp +33 -33
- package/src/duckdb/src/include/duckdb/core_functions/scalar/operators_functions.hpp +2 -2
- package/src/duckdb/src/include/duckdb/core_functions/scalar/random_functions.hpp +3 -3
- package/src/duckdb/src/include/duckdb/core_functions/scalar/string_functions.hpp +12 -12
- package/src/duckdb/src/include/duckdb/core_functions/scalar/struct_functions.hpp +2 -2
- package/src/duckdb/src/include/duckdb/core_functions/scalar/union_functions.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +2 -1
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/prepared_statement_data.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/bound_parameter_map.hpp +28 -1
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_data.hpp +0 -18
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +1 -2
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/planner.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +1 -1
- package/src/duckdb/src/main/capi/prepared-c.cpp +9 -3
- package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +1 -0
- package/src/duckdb/src/planner/binder/expression/bind_parameter_expression.cpp +9 -19
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +28 -6
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +3 -0
- package/src/duckdb/src/planner/bound_parameter_map.cpp +67 -0
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +14 -6
- package/src/duckdb/src/planner/operator/logical_create_table.cpp +3 -3
- package/src/duckdb/src/planner/operator/logical_delete.cpp +3 -2
- package/src/duckdb/src/planner/operator/logical_insert.cpp +3 -2
- package/src/duckdb/src/planner/operator/logical_update.cpp +3 -2
- package/src/duckdb/src/planner/planner.cpp +2 -2
- package/src/duckdb/src/storage/data_table.cpp +8 -8
- package/src/duckdb/src/storage/local_storage.cpp +2 -3
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +64 -80
- package/src/duckdb/src/storage/storage_manager.cpp +6 -2
- package/src/duckdb/src/storage/table/row_group.cpp +6 -0
- package/src/duckdb/src/storage/table/row_group_collection.cpp +4 -3
- package/src/duckdb/src/storage/table/struct_column_data.cpp +5 -0
- package/src/duckdb/src/transaction/duck_transaction.cpp +1 -0
- package/src/duckdb/ub_src_planner.cpp +2 -0
@@ -11,9 +11,10 @@ LogicalDelete::LogicalDelete(TableCatalogEntry &table, idx_t table_index)
|
|
11
11
|
return_chunk(false) {
|
12
12
|
}
|
13
13
|
|
14
|
-
LogicalDelete::LogicalDelete(ClientContext &context, const
|
14
|
+
LogicalDelete::LogicalDelete(ClientContext &context, const unique_ptr<CreateInfo> &table_info)
|
15
15
|
: LogicalOperator(LogicalOperatorType::LOGICAL_DELETE),
|
16
|
-
table(Catalog::GetEntry<TableCatalogEntry>(context, catalog, schema,
|
16
|
+
table(Catalog::GetEntry<TableCatalogEntry>(context, table_info->catalog, table_info->schema,
|
17
|
+
dynamic_cast<CreateTableInfo &>(*table_info).table)) {
|
17
18
|
}
|
18
19
|
|
19
20
|
idx_t LogicalDelete::EstimateCardinality(ClientContext &context) {
|
@@ -11,9 +11,10 @@ LogicalInsert::LogicalInsert(TableCatalogEntry &table, idx_t table_index)
|
|
11
11
|
action_type(OnConflictAction::THROW) {
|
12
12
|
}
|
13
13
|
|
14
|
-
LogicalInsert::LogicalInsert(ClientContext &context, const
|
14
|
+
LogicalInsert::LogicalInsert(ClientContext &context, const unique_ptr<CreateInfo> table_info)
|
15
15
|
: LogicalOperator(LogicalOperatorType::LOGICAL_INSERT),
|
16
|
-
table(Catalog::GetEntry<TableCatalogEntry>(context, catalog, schema,
|
16
|
+
table(Catalog::GetEntry<TableCatalogEntry>(context, table_info->catalog, table_info->schema,
|
17
|
+
dynamic_cast<CreateTableInfo &>(*table_info).table)) {
|
17
18
|
}
|
18
19
|
|
19
20
|
idx_t LogicalInsert::EstimateCardinality(ClientContext &context) {
|
@@ -9,9 +9,10 @@ LogicalUpdate::LogicalUpdate(TableCatalogEntry &table)
|
|
9
9
|
: LogicalOperator(LogicalOperatorType::LOGICAL_UPDATE), table(table), table_index(0), return_chunk(false) {
|
10
10
|
}
|
11
11
|
|
12
|
-
LogicalUpdate::LogicalUpdate(ClientContext &context, const
|
12
|
+
LogicalUpdate::LogicalUpdate(ClientContext &context, const unique_ptr<CreateInfo> &table_info)
|
13
13
|
: LogicalOperator(LogicalOperatorType::LOGICAL_UPDATE),
|
14
|
-
table(Catalog::GetEntry<TableCatalogEntry>(context, catalog, schema,
|
14
|
+
table(Catalog::GetEntry<TableCatalogEntry>(context, table_info->catalog, table_info->schema,
|
15
|
+
dynamic_cast<CreateTableInfo &>(*table_info).table)) {
|
15
16
|
}
|
16
17
|
|
17
18
|
idx_t LogicalUpdate::EstimateCardinality(ClientContext &context) {
|
@@ -78,10 +78,10 @@ void Planner::CreatePlan(SQLStatement &statement) {
|
|
78
78
|
this->properties.parameter_count = parameter_count;
|
79
79
|
properties.bound_all_parameters = parameters_resolved;
|
80
80
|
|
81
|
-
Planner::VerifyPlan(context, plan,
|
81
|
+
Planner::VerifyPlan(context, plan, bound_parameters.GetParametersPtr());
|
82
82
|
|
83
83
|
// set up a map of parameter number -> value entries
|
84
|
-
for (auto &kv : bound_parameters.
|
84
|
+
for (auto &kv : bound_parameters.GetParameters()) {
|
85
85
|
auto &identifier = kv.first;
|
86
86
|
auto ¶m = kv.second;
|
87
87
|
// check if the type of the parameter could be resolved
|
@@ -748,6 +748,9 @@ void DataTable::Append(DataChunk &chunk, TableAppendState &state) {
|
|
748
748
|
}
|
749
749
|
|
750
750
|
void DataTable::ScanTableSegment(idx_t row_start, idx_t count, const std::function<void(DataChunk &chunk)> &function) {
|
751
|
+
if (count == 0) {
|
752
|
+
return;
|
753
|
+
}
|
751
754
|
idx_t end = row_start + count;
|
752
755
|
|
753
756
|
vector<column_t> column_ids;
|
@@ -817,16 +820,12 @@ void DataTable::CommitAppend(transaction_t commit_id, idx_t row_start, idx_t cou
|
|
817
820
|
info->cardinality += count;
|
818
821
|
}
|
819
822
|
|
820
|
-
void DataTable::RevertAppendInternal(idx_t start_row
|
821
|
-
if (count == 0) {
|
822
|
-
// nothing to revert!
|
823
|
-
return;
|
824
|
-
}
|
823
|
+
void DataTable::RevertAppendInternal(idx_t start_row) {
|
825
824
|
// adjust the cardinality
|
826
825
|
info->cardinality = start_row;
|
827
826
|
D_ASSERT(is_root);
|
828
827
|
// revert appends made to row_groups
|
829
|
-
row_groups->RevertAppendInternal(start_row
|
828
|
+
row_groups->RevertAppendInternal(start_row);
|
830
829
|
}
|
831
830
|
|
832
831
|
void DataTable::RevertAppend(idx_t start_row, idx_t count) {
|
@@ -837,7 +836,8 @@ void DataTable::RevertAppend(idx_t start_row, idx_t count) {
|
|
837
836
|
idx_t current_row_base = start_row;
|
838
837
|
row_t row_data[STANDARD_VECTOR_SIZE];
|
839
838
|
Vector row_identifiers(LogicalType::ROW_TYPE, data_ptr_cast(row_data));
|
840
|
-
|
839
|
+
idx_t scan_count = MinValue<idx_t>(count, row_groups->GetTotalRows() - start_row);
|
840
|
+
ScanTableSegment(start_row, scan_count, [&](DataChunk &chunk) {
|
841
841
|
for (idx_t i = 0; i < chunk.size(); i++) {
|
842
842
|
row_data[i] = current_row_base + i;
|
843
843
|
}
|
@@ -857,7 +857,7 @@ void DataTable::RevertAppend(idx_t start_row, idx_t count) {
|
|
857
857
|
});
|
858
858
|
|
859
859
|
// revert the data table append
|
860
|
-
RevertAppendInternal(start_row
|
860
|
+
RevertAppendInternal(start_row);
|
861
861
|
}
|
862
862
|
|
863
863
|
//===--------------------------------------------------------------------===//
|
@@ -178,7 +178,7 @@ void LocalTableStorage::AppendToIndexes(DuckTransaction &transaction, TableAppen
|
|
178
178
|
return true;
|
179
179
|
});
|
180
180
|
if (append_to_table) {
|
181
|
-
table.RevertAppendInternal(append_state.row_start
|
181
|
+
table.RevertAppendInternal(append_state.row_start);
|
182
182
|
}
|
183
183
|
|
184
184
|
// we need to vacuum the indexes to remove any buffers that are now empty
|
@@ -353,7 +353,6 @@ void LocalStorage::Append(LocalAppendState &state, DataChunk &chunk) {
|
|
353
353
|
|
354
354
|
//! Append the chunk to the local storage
|
355
355
|
auto new_row_group = storage->row_groups->Append(chunk, state.append_state);
|
356
|
-
|
357
356
|
//! Check if we should pre-emptively flush blocks to disk
|
358
357
|
if (new_row_group) {
|
359
358
|
storage->WriteNewRowGroup();
|
@@ -432,6 +431,7 @@ void LocalStorage::Flush(DataTable &table, LocalTableStorage &storage) {
|
|
432
431
|
|
433
432
|
TableAppendState append_state;
|
434
433
|
table.AppendLock(append_state);
|
434
|
+
transaction.PushAppend(table, append_state.row_start, append_count);
|
435
435
|
if ((append_state.row_start == 0 || storage.row_groups->GetTotalRows() >= MERGE_THRESHOLD) &&
|
436
436
|
storage.deleted_rows == 0) {
|
437
437
|
// table is currently empty OR we are bulk appending: move over the storage directly
|
@@ -453,7 +453,6 @@ void LocalStorage::Flush(DataTable &table, LocalTableStorage &storage) {
|
|
453
453
|
// append to the indexes and append to the base table
|
454
454
|
storage.AppendToIndexes(transaction, append_state, append_count, true);
|
455
455
|
}
|
456
|
-
transaction.PushAppend(table, append_state.row_start, append_count);
|
457
456
|
|
458
457
|
// possibly vacuum any excess index data
|
459
458
|
table.info->indexes.Scan([&](Index &index) {
|
@@ -314,16 +314,12 @@ unique_ptr<LogicalOperator> LogicalCreateIndex::Deserialize(Deserializer &deseri
|
|
314
314
|
|
315
315
|
void LogicalCreateTable::Serialize(Serializer &serializer) const {
|
316
316
|
LogicalOperator::Serialize(serializer);
|
317
|
-
serializer.WriteProperty(200, "
|
318
|
-
serializer.WriteProperty(201, "schema", schema.name);
|
319
|
-
serializer.WriteProperty(202, "info", info->base);
|
317
|
+
serializer.WriteProperty(200, "info", info->base);
|
320
318
|
}
|
321
319
|
|
322
320
|
unique_ptr<LogicalOperator> LogicalCreateTable::Deserialize(Deserializer &deserializer) {
|
323
|
-
auto
|
324
|
-
auto
|
325
|
-
auto info = deserializer.ReadProperty<unique_ptr<CreateInfo>>(202, "info");
|
326
|
-
auto result = duckdb::unique_ptr<LogicalCreateTable>(new LogicalCreateTable(deserializer.Get<ClientContext &>(), catalog, schema, std::move(info)));
|
321
|
+
auto info = deserializer.ReadProperty<unique_ptr<CreateInfo>>(200, "info");
|
322
|
+
auto result = duckdb::unique_ptr<LogicalCreateTable>(new LogicalCreateTable(deserializer.Get<ClientContext &>(), std::move(info)));
|
327
323
|
return std::move(result);
|
328
324
|
}
|
329
325
|
|
@@ -338,22 +334,18 @@ unique_ptr<LogicalOperator> LogicalCrossProduct::Deserialize(Deserializer &deser
|
|
338
334
|
|
339
335
|
void LogicalDelete::Serialize(Serializer &serializer) const {
|
340
336
|
LogicalOperator::Serialize(serializer);
|
341
|
-
serializer.WriteProperty(200, "
|
342
|
-
serializer.WriteProperty(201, "
|
343
|
-
serializer.WriteProperty(202, "
|
344
|
-
serializer.WriteProperty(203, "
|
345
|
-
serializer.WriteProperty(204, "return_chunk", return_chunk);
|
346
|
-
serializer.WriteProperty(205, "expressions", expressions);
|
337
|
+
serializer.WriteProperty(200, "table_info", table.GetInfo());
|
338
|
+
serializer.WriteProperty(201, "table_index", table_index);
|
339
|
+
serializer.WriteProperty(202, "return_chunk", return_chunk);
|
340
|
+
serializer.WriteProperty(203, "expressions", expressions);
|
347
341
|
}
|
348
342
|
|
349
343
|
unique_ptr<LogicalOperator> LogicalDelete::Deserialize(Deserializer &deserializer) {
|
350
|
-
auto
|
351
|
-
auto
|
352
|
-
|
353
|
-
|
354
|
-
deserializer.ReadProperty(203, "
|
355
|
-
deserializer.ReadProperty(204, "return_chunk", result->return_chunk);
|
356
|
-
deserializer.ReadProperty(205, "expressions", result->expressions);
|
344
|
+
auto table_info = deserializer.ReadProperty<unique_ptr<CreateInfo>>(200, "table_info");
|
345
|
+
auto result = duckdb::unique_ptr<LogicalDelete>(new LogicalDelete(deserializer.Get<ClientContext &>(), table_info));
|
346
|
+
deserializer.ReadProperty(201, "table_index", result->table_index);
|
347
|
+
deserializer.ReadProperty(202, "return_chunk", result->return_chunk);
|
348
|
+
deserializer.ReadProperty(203, "expressions", result->expressions);
|
357
349
|
return std::move(result);
|
358
350
|
}
|
359
351
|
|
@@ -456,50 +448,46 @@ unique_ptr<LogicalOperator> LogicalFilter::Deserialize(Deserializer &deserialize
|
|
456
448
|
|
457
449
|
void LogicalInsert::Serialize(Serializer &serializer) const {
|
458
450
|
LogicalOperator::Serialize(serializer);
|
459
|
-
serializer.WriteProperty(200, "
|
460
|
-
serializer.WriteProperty(201, "
|
461
|
-
serializer.WriteProperty(202, "
|
462
|
-
serializer.WriteProperty(203, "
|
463
|
-
serializer.WriteProperty(204, "
|
464
|
-
serializer.WriteProperty(205, "
|
465
|
-
serializer.WriteProperty(206, "
|
466
|
-
serializer.WriteProperty(207, "
|
467
|
-
serializer.WriteProperty(208, "
|
468
|
-
serializer.WriteProperty(209, "
|
469
|
-
serializer.
|
470
|
-
serializer.
|
471
|
-
serializer.
|
472
|
-
serializer.
|
473
|
-
serializer.WriteProperty(214, "
|
474
|
-
serializer.WriteProperty(215, "
|
475
|
-
serializer.WriteProperty(216, "
|
476
|
-
serializer.WriteProperty(217, "
|
477
|
-
serializer.WriteProperty(218, "source_columns", source_columns);
|
478
|
-
serializer.WriteProperty(219, "expressions", expressions);
|
451
|
+
serializer.WriteProperty(200, "table_info", table.GetInfo());
|
452
|
+
serializer.WriteProperty(201, "insert_values", insert_values);
|
453
|
+
serializer.WriteProperty(202, "column_index_map", column_index_map);
|
454
|
+
serializer.WriteProperty(203, "expected_types", expected_types);
|
455
|
+
serializer.WriteProperty(204, "table_index", table_index);
|
456
|
+
serializer.WriteProperty(205, "return_chunk", return_chunk);
|
457
|
+
serializer.WriteProperty(206, "bound_defaults", bound_defaults);
|
458
|
+
serializer.WriteProperty(207, "action_type", action_type);
|
459
|
+
serializer.WriteProperty(208, "expected_set_types", expected_set_types);
|
460
|
+
serializer.WriteProperty(209, "on_conflict_filter", on_conflict_filter);
|
461
|
+
serializer.WritePropertyWithDefault(210, "on_conflict_condition", on_conflict_condition, unique_ptr<Expression>());
|
462
|
+
serializer.WritePropertyWithDefault(211, "do_update_condition", do_update_condition, unique_ptr<Expression>());
|
463
|
+
serializer.WriteProperty(212, "set_columns", set_columns);
|
464
|
+
serializer.WriteProperty(213, "set_types", set_types);
|
465
|
+
serializer.WriteProperty(214, "excluded_table_index", excluded_table_index);
|
466
|
+
serializer.WriteProperty(215, "columns_to_fetch", columns_to_fetch);
|
467
|
+
serializer.WriteProperty(216, "source_columns", source_columns);
|
468
|
+
serializer.WriteProperty(217, "expressions", expressions);
|
479
469
|
}
|
480
470
|
|
481
471
|
unique_ptr<LogicalOperator> LogicalInsert::Deserialize(Deserializer &deserializer) {
|
482
|
-
auto
|
483
|
-
auto
|
484
|
-
|
485
|
-
|
486
|
-
deserializer.ReadProperty(203, "
|
487
|
-
deserializer.ReadProperty(204, "
|
488
|
-
deserializer.ReadProperty(205, "
|
489
|
-
deserializer.ReadProperty(206, "
|
490
|
-
deserializer.ReadProperty(207, "
|
491
|
-
deserializer.ReadProperty(208, "
|
492
|
-
deserializer.ReadProperty(209, "
|
493
|
-
deserializer.
|
494
|
-
deserializer.
|
495
|
-
deserializer.
|
496
|
-
deserializer.
|
497
|
-
deserializer.ReadProperty(214, "
|
498
|
-
deserializer.ReadProperty(215, "
|
499
|
-
deserializer.ReadProperty(216, "
|
500
|
-
deserializer.ReadProperty(217, "
|
501
|
-
deserializer.ReadProperty(218, "source_columns", result->source_columns);
|
502
|
-
deserializer.ReadProperty(219, "expressions", result->expressions);
|
472
|
+
auto table_info = deserializer.ReadProperty<unique_ptr<CreateInfo>>(200, "table_info");
|
473
|
+
auto result = duckdb::unique_ptr<LogicalInsert>(new LogicalInsert(deserializer.Get<ClientContext &>(), std::move(table_info)));
|
474
|
+
deserializer.ReadProperty(201, "insert_values", result->insert_values);
|
475
|
+
deserializer.ReadProperty(202, "column_index_map", result->column_index_map);
|
476
|
+
deserializer.ReadProperty(203, "expected_types", result->expected_types);
|
477
|
+
deserializer.ReadProperty(204, "table_index", result->table_index);
|
478
|
+
deserializer.ReadProperty(205, "return_chunk", result->return_chunk);
|
479
|
+
deserializer.ReadProperty(206, "bound_defaults", result->bound_defaults);
|
480
|
+
deserializer.ReadProperty(207, "action_type", result->action_type);
|
481
|
+
deserializer.ReadProperty(208, "expected_set_types", result->expected_set_types);
|
482
|
+
deserializer.ReadProperty(209, "on_conflict_filter", result->on_conflict_filter);
|
483
|
+
deserializer.ReadPropertyWithDefault(210, "on_conflict_condition", result->on_conflict_condition, unique_ptr<Expression>());
|
484
|
+
deserializer.ReadPropertyWithDefault(211, "do_update_condition", result->do_update_condition, unique_ptr<Expression>());
|
485
|
+
deserializer.ReadProperty(212, "set_columns", result->set_columns);
|
486
|
+
deserializer.ReadProperty(213, "set_types", result->set_types);
|
487
|
+
deserializer.ReadProperty(214, "excluded_table_index", result->excluded_table_index);
|
488
|
+
deserializer.ReadProperty(215, "columns_to_fetch", result->columns_to_fetch);
|
489
|
+
deserializer.ReadProperty(216, "source_columns", result->source_columns);
|
490
|
+
deserializer.ReadProperty(217, "expressions", result->expressions);
|
503
491
|
return std::move(result);
|
504
492
|
}
|
505
493
|
|
@@ -723,28 +711,24 @@ unique_ptr<LogicalOperator> LogicalUnnest::Deserialize(Deserializer &deserialize
|
|
723
711
|
|
724
712
|
void LogicalUpdate::Serialize(Serializer &serializer) const {
|
725
713
|
LogicalOperator::Serialize(serializer);
|
726
|
-
serializer.WriteProperty(200, "
|
727
|
-
serializer.WriteProperty(201, "
|
728
|
-
serializer.WriteProperty(202, "
|
729
|
-
serializer.WriteProperty(203, "
|
730
|
-
serializer.WriteProperty(204, "
|
731
|
-
serializer.WriteProperty(205, "
|
732
|
-
serializer.WriteProperty(206, "
|
733
|
-
serializer.WriteProperty(207, "bound_defaults", bound_defaults);
|
734
|
-
serializer.WriteProperty(208, "update_is_del_and_insert", update_is_del_and_insert);
|
714
|
+
serializer.WriteProperty(200, "table_info", table.GetInfo());
|
715
|
+
serializer.WriteProperty(201, "table_index", table_index);
|
716
|
+
serializer.WriteProperty(202, "return_chunk", return_chunk);
|
717
|
+
serializer.WriteProperty(203, "expressions", expressions);
|
718
|
+
serializer.WriteProperty(204, "columns", columns);
|
719
|
+
serializer.WriteProperty(205, "bound_defaults", bound_defaults);
|
720
|
+
serializer.WriteProperty(206, "update_is_del_and_insert", update_is_del_and_insert);
|
735
721
|
}
|
736
722
|
|
737
723
|
unique_ptr<LogicalOperator> LogicalUpdate::Deserialize(Deserializer &deserializer) {
|
738
|
-
auto
|
739
|
-
auto
|
740
|
-
|
741
|
-
|
742
|
-
deserializer.ReadProperty(203, "
|
743
|
-
deserializer.ReadProperty(204, "
|
744
|
-
deserializer.ReadProperty(205, "
|
745
|
-
deserializer.ReadProperty(206, "
|
746
|
-
deserializer.ReadProperty(207, "bound_defaults", result->bound_defaults);
|
747
|
-
deserializer.ReadProperty(208, "update_is_del_and_insert", result->update_is_del_and_insert);
|
724
|
+
auto table_info = deserializer.ReadProperty<unique_ptr<CreateInfo>>(200, "table_info");
|
725
|
+
auto result = duckdb::unique_ptr<LogicalUpdate>(new LogicalUpdate(deserializer.Get<ClientContext &>(), table_info));
|
726
|
+
deserializer.ReadProperty(201, "table_index", result->table_index);
|
727
|
+
deserializer.ReadProperty(202, "return_chunk", result->return_chunk);
|
728
|
+
deserializer.ReadProperty(203, "expressions", result->expressions);
|
729
|
+
deserializer.ReadProperty(204, "columns", result->columns);
|
730
|
+
deserializer.ReadProperty(205, "bound_defaults", result->bound_defaults);
|
731
|
+
deserializer.ReadProperty(206, "update_is_del_and_insert", result->update_is_del_and_insert);
|
748
732
|
return std::move(result);
|
749
733
|
}
|
750
734
|
|
@@ -235,8 +235,12 @@ void SingleFileStorageManager::CreateCheckpoint(bool delete_wal, bool force_chec
|
|
235
235
|
auto &config = DBConfig::Get(db);
|
236
236
|
if (wal->GetWALSize() > 0 || config.options.force_checkpoint || force_checkpoint) {
|
237
237
|
// we only need to checkpoint if there is anything in the WAL
|
238
|
-
|
239
|
-
|
238
|
+
try {
|
239
|
+
SingleFileCheckpointWriter checkpointer(db, *block_manager);
|
240
|
+
checkpointer.CreateCheckpoint();
|
241
|
+
} catch (std::exception &ex) {
|
242
|
+
throw FatalException("Failed to create checkpoint because of error: %s", ex.what());
|
243
|
+
}
|
240
244
|
}
|
241
245
|
if (delete_wal) {
|
242
246
|
wal->Delete();
|
@@ -782,6 +782,12 @@ RowGroupPointer RowGroup::Checkpoint(RowGroupWriter &writer, TableStatistics &gl
|
|
782
782
|
vector<CompressionType> compression_types;
|
783
783
|
compression_types.reserve(columns.size());
|
784
784
|
for (idx_t column_idx = 0; column_idx < GetColumnCount(); column_idx++) {
|
785
|
+
auto &column = GetColumn(column_idx);
|
786
|
+
if (column.count != this->count) {
|
787
|
+
throw InternalException("Corrupted in-memory column - column with index %llu has misaligned count (row "
|
788
|
+
"group has %llu rows, column has %llu)",
|
789
|
+
column_idx, this->count.load(), column.count);
|
790
|
+
}
|
785
791
|
compression_types.push_back(writer.GetColumnCompressionType(column_idx));
|
786
792
|
}
|
787
793
|
auto result = WriteToDisk(writer.GetPartialBlockManager(), compression_types);
|
@@ -33,6 +33,7 @@ void RowGroupSegmentTree::Initialize(PersistentTableData &data) {
|
|
33
33
|
|
34
34
|
unique_ptr<RowGroup> RowGroupSegmentTree::LoadSegment() {
|
35
35
|
if (current_row_group >= max_row_group) {
|
36
|
+
reader.reset();
|
36
37
|
finished_loading = true;
|
37
38
|
return nullptr;
|
38
39
|
}
|
@@ -426,9 +427,9 @@ void RowGroupCollection::CommitAppend(transaction_t commit_id, idx_t row_start,
|
|
426
427
|
}
|
427
428
|
}
|
428
429
|
|
429
|
-
void RowGroupCollection::RevertAppendInternal(idx_t start_row
|
430
|
-
if (total_rows
|
431
|
-
|
430
|
+
void RowGroupCollection::RevertAppendInternal(idx_t start_row) {
|
431
|
+
if (total_rows <= start_row) {
|
432
|
+
return;
|
432
433
|
}
|
433
434
|
total_rows = start_row;
|
434
435
|
|
@@ -15,6 +15,9 @@ StructColumnData::StructColumnData(BlockManager &block_manager, DataTableInfo &i
|
|
15
15
|
D_ASSERT(type.InternalType() == PhysicalType::STRUCT);
|
16
16
|
auto &child_types = StructType::GetChildTypes(type);
|
17
17
|
D_ASSERT(child_types.size() > 0);
|
18
|
+
if (type.id() != LogicalTypeId::UNION && StructType::IsUnnamed(type)) {
|
19
|
+
throw InvalidInputException("A table cannot be created from an unnamed struct");
|
20
|
+
}
|
18
21
|
// the sub column index, starting at 1 (0 is the validity mask)
|
19
22
|
idx_t sub_column_index = 1;
|
20
23
|
for (auto &child_type : child_types) {
|
@@ -128,6 +131,7 @@ void StructColumnData::Append(BaseStatistics &stats, ColumnAppendState &state, V
|
|
128
131
|
sub_columns[i]->Append(StructStats::GetChildStats(stats, i), state.child_appends[i + 1], *child_entries[i],
|
129
132
|
count);
|
130
133
|
}
|
134
|
+
this->count += count;
|
131
135
|
}
|
132
136
|
|
133
137
|
void StructColumnData::RevertAppend(row_t start_row) {
|
@@ -135,6 +139,7 @@ void StructColumnData::RevertAppend(row_t start_row) {
|
|
135
139
|
for (auto &sub_column : sub_columns) {
|
136
140
|
sub_column->RevertAppend(start_row);
|
137
141
|
}
|
142
|
+
this->count = start_row - this->start;
|
138
143
|
}
|
139
144
|
|
140
145
|
idx_t StructColumnData::Fetch(ColumnScanState &state, row_t row_id, Vector &result) {
|