duckdb 0.6.2-dev2115.0 → 0.6.2-dev2226.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.
Files changed (85) hide show
  1. package/package.json +1 -1
  2. package/src/duckdb/extension/json/buffered_json_reader.cpp +18 -5
  3. package/src/duckdb/extension/json/include/buffered_json_reader.hpp +6 -1
  4. package/src/duckdb/extension/json/include/json_common.hpp +1 -0
  5. package/src/duckdb/extension/json/include/json_scan.hpp +7 -0
  6. package/src/duckdb/extension/json/include/json_transform.hpp +25 -10
  7. package/src/duckdb/extension/json/json_common.cpp +6 -2
  8. package/src/duckdb/extension/json/json_functions/json_structure.cpp +47 -9
  9. package/src/duckdb/extension/json/json_functions/json_transform.cpp +183 -106
  10. package/src/duckdb/extension/json/json_functions/read_json.cpp +35 -22
  11. package/src/duckdb/extension/json/json_scan.cpp +26 -5
  12. package/src/duckdb/extension/parquet/parquet-extension.cpp +1 -0
  13. package/src/duckdb/src/catalog/catalog.cpp +11 -12
  14. package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +1 -1
  15. package/src/duckdb/src/common/box_renderer.cpp +9 -1
  16. package/src/duckdb/src/common/compressed_file_system.cpp +1 -1
  17. package/src/duckdb/src/common/enums/relation_type.cpp +2 -0
  18. package/src/duckdb/src/common/gzip_file_system.cpp +1 -1
  19. package/src/duckdb/src/common/local_file_system.cpp +1 -1
  20. package/src/duckdb/src/common/row_operations/row_aggregate.cpp +2 -2
  21. package/src/duckdb/src/common/types/column_data_allocator.cpp +2 -2
  22. package/src/duckdb/src/common/types/date.cpp +7 -2
  23. package/src/duckdb/src/common/types/vector.cpp +3 -2
  24. package/src/duckdb/src/common/virtual_file_system.cpp +1 -1
  25. package/src/duckdb/src/execution/index/art/art.cpp +5 -5
  26. package/src/duckdb/src/execution/join_hashtable.cpp +4 -5
  27. package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +2 -0
  28. package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +182 -123
  29. package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +22 -18
  30. package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +1 -1
  31. package/src/duckdb/src/function/aggregate/distributive/arg_min_max.cpp +2 -3
  32. package/src/duckdb/src/function/scalar/math/setseed.cpp +1 -1
  33. package/src/duckdb/src/function/scalar/string/substring.cpp +8 -0
  34. package/src/duckdb/src/function/table/read_csv.cpp +1 -1
  35. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  36. package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +2 -0
  37. package/src/duckdb/src/include/duckdb/common/box_renderer.hpp +4 -0
  38. package/src/duckdb/src/include/duckdb/common/enums/relation_type.hpp +1 -0
  39. package/src/duckdb/src/include/duckdb/common/file_opener.hpp +2 -0
  40. package/src/duckdb/src/include/duckdb/common/http_stats.hpp +1 -1
  41. package/src/duckdb/src/include/duckdb/common/limits.hpp +3 -0
  42. package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +1 -9
  43. package/src/duckdb/src/include/duckdb/common/types/vector.hpp +2 -2
  44. package/src/duckdb/src/include/duckdb/execution/executor.hpp +3 -0
  45. package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +3 -3
  46. package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_unnest.hpp +5 -1
  47. package/src/duckdb/src/include/duckdb/main/client_context.hpp +3 -0
  48. package/src/duckdb/src/include/duckdb/main/config.hpp +0 -4
  49. package/src/duckdb/src/include/duckdb/main/database.hpp +6 -0
  50. package/src/duckdb/src/include/duckdb/main/extension_helper.hpp +5 -5
  51. package/src/duckdb/src/include/duckdb/main/relation/write_csv_relation.hpp +2 -1
  52. package/src/duckdb/src/include/duckdb/main/relation/write_parquet_relation.hpp +34 -0
  53. package/src/duckdb/src/include/duckdb/main/relation.hpp +6 -1
  54. package/src/duckdb/src/include/duckdb/parser/parsed_data/copy_info.hpp +2 -1
  55. package/src/duckdb/src/include/duckdb/parser/statement/copy_statement.hpp +1 -1
  56. package/src/duckdb/src/include/duckdb/planner/binder.hpp +1 -1
  57. package/src/duckdb/src/include/duckdb/storage/index.hpp +4 -3
  58. package/src/duckdb/src/include/duckdb.h +7 -0
  59. package/src/duckdb/src/main/capi/threading-c.cpp +8 -0
  60. package/src/duckdb/src/main/client_context.cpp +7 -0
  61. package/src/duckdb/src/main/client_context_file_opener.cpp +14 -0
  62. package/src/duckdb/src/main/database.cpp +57 -40
  63. package/src/duckdb/src/main/extension/extension_load.cpp +20 -28
  64. package/src/duckdb/src/main/relation/write_csv_relation.cpp +4 -2
  65. package/src/duckdb/src/main/relation/write_parquet_relation.cpp +37 -0
  66. package/src/duckdb/src/main/relation.cpp +12 -2
  67. package/src/duckdb/src/parallel/executor.cpp +4 -0
  68. package/src/duckdb/src/parser/statement/copy_statement.cpp +1 -1
  69. package/src/duckdb/src/parser/transform/statement/transform_show.cpp +4 -3
  70. package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +1 -1
  71. package/src/duckdb/src/planner/binder/statement/bind_create.cpp +24 -3
  72. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +1 -1
  73. package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +2 -0
  74. package/src/duckdb/src/storage/compression/bitpacking.cpp +2 -1
  75. package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +1 -1
  76. package/src/duckdb/src/storage/index.cpp +1 -1
  77. package/src/duckdb/src/storage/meta_block_writer.cpp +1 -1
  78. package/src/duckdb/src/storage/table/column_segment.cpp +3 -3
  79. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +1 -2
  80. package/src/duckdb/third_party/libpg_query/src_backend_parser_scan.cpp +539 -300
  81. package/src/duckdb/ub_src_main.cpp +0 -2
  82. package/src/duckdb/ub_src_main_relation.cpp +2 -0
  83. package/src/duckdb/src/include/duckdb/function/replacement_open.hpp +0 -54
  84. package/src/duckdb/src/include/duckdb/main/replacement_opens.hpp +0 -20
  85. package/src/duckdb/src/main/extension_prefix_opener.cpp +0 -55
@@ -92,6 +92,7 @@ void JSONScanData::Serialize(FieldWriter &writer) {
92
92
  writer.WriteField<idx_t>(sample_size);
93
93
  writer.WriteList<string>(names);
94
94
  writer.WriteField<idx_t>(max_depth);
95
+ writer.WriteField<bool>(objects);
95
96
  }
96
97
 
97
98
  void JSONScanData::Deserialize(FieldReader &reader) {
@@ -105,6 +106,7 @@ void JSONScanData::Deserialize(FieldReader &reader) {
105
106
  sample_size = reader.ReadRequired<idx_t>();
106
107
  names = reader.ReadRequiredList<string>();
107
108
  max_depth = reader.ReadRequired<idx_t>();
109
+ objects = reader.ReadRequired<bool>();
108
110
  }
109
111
 
110
112
  JSONScanGlobalState::JSONScanGlobalState(ClientContext &context, JSONScanData &bind_data_p)
@@ -144,16 +146,20 @@ unique_ptr<GlobalTableFunctionState> JSONGlobalTableFunctionState::Init(ClientCo
144
146
  auto &bind_data = (JSONScanData &)*input.bind_data;
145
147
  auto result = make_unique<JSONGlobalTableFunctionState>(context, input);
146
148
 
147
- // Check if we need to do projection pushdown
148
- if (bind_data.type == JSONScanType::READ_JSON && input.column_ids.size() != bind_data.names.size()) {
149
- D_ASSERT(input.column_ids.size() < bind_data.names.size()); // Can't project to have more columns
149
+ // Perform projection pushdown
150
+ if (bind_data.type == JSONScanType::READ_JSON) {
151
+ D_ASSERT(input.column_ids.size() <= bind_data.names.size()); // Can't project to have more columns
152
+ if (bind_data.auto_detect && input.column_ids.size() < bind_data.names.size()) {
153
+ // If we are auto-detecting, but don't need all columns present in the file,
154
+ // then we don't need to throw an error if we encounter an unseen column
155
+ bind_data.transform_options.error_unknown_key = false;
156
+ }
150
157
  vector<string> names;
151
158
  names.reserve(input.column_ids.size());
152
159
  for (const auto &id : input.column_ids) {
153
160
  names.push_back(std::move(bind_data.names[id]));
154
161
  }
155
162
  bind_data.names = std::move(names);
156
- bind_data.transform_options.error_unknown_key = false;
157
163
  }
158
164
  return result;
159
165
  }
@@ -170,7 +176,14 @@ unique_ptr<LocalTableFunctionState> JSONLocalTableFunctionState::Init(ExecutionC
170
176
  TableFunctionInitInput &input,
171
177
  GlobalTableFunctionState *global_state) {
172
178
  auto &gstate = (JSONGlobalTableFunctionState &)*global_state;
173
- return make_unique<JSONLocalTableFunctionState>(context.client, gstate.state);
179
+ auto result = make_unique<JSONLocalTableFunctionState>(context.client, gstate.state);
180
+
181
+ // Copy the transform options / date format map because we need to do thread-local stuff
182
+ result->state.date_format_map = gstate.state.bind_data.date_format_map;
183
+ result->state.transform_options = gstate.state.bind_data.transform_options;
184
+ result->state.transform_options.date_format_map = &result->state.date_format_map;
185
+
186
+ return result;
174
187
  }
175
188
 
176
189
  idx_t JSONLocalTableFunctionState::GetBatchIndex() const {
@@ -604,4 +617,12 @@ yyjson_alc *JSONScanLocalState::GetAllocator() {
604
617
  return json_allocator.GetYYJSONAllocator();
605
618
  }
606
619
 
620
+ void JSONScanLocalState::ThrowTransformError(idx_t count, idx_t object_index, const string &error_message) {
621
+ D_ASSERT(current_reader);
622
+ D_ASSERT(current_buffer_handle);
623
+ D_ASSERT(object_index != DConstants::INVALID_INDEX);
624
+ auto line_or_object_in_buffer = lines_or_objects_in_buffer - count + object_index;
625
+ current_reader->ThrowTransformError(current_buffer_handle->buffer_index, line_or_object_in_buffer, error_message);
626
+ }
627
+
607
628
  } // namespace duckdb
@@ -174,6 +174,7 @@ public:
174
174
  table_function.named_parameters["file_row_number"] = LogicalType::BOOLEAN;
175
175
  table_function.named_parameters["hive_partitioning"] = LogicalType::BOOLEAN;
176
176
  table_function.named_parameters["union_by_name"] = LogicalType::BOOLEAN;
177
+ table_function.named_parameters["compression"] = LogicalType::VARCHAR;
177
178
  table_function.get_batch_index = ParquetScanGetBatchIndex;
178
179
  table_function.serialize = ParquetScanSerialize;
179
180
  table_function.deserialize = ParquetScanDeserialize;
@@ -552,20 +552,19 @@ SchemaCatalogEntry *Catalog::GetSchema(ClientContext &context, const string &cat
552
552
  return result;
553
553
  }
554
554
 
555
+ LogicalType Catalog::GetType(ClientContext &context, const string &schema, const string &name, bool if_exists) {
556
+ auto type_entry = GetEntry<TypeCatalogEntry>(context, schema, name, if_exists);
557
+ if (!type_entry) {
558
+ return LogicalType::INVALID;
559
+ }
560
+ auto result_type = type_entry->user_type;
561
+ LogicalType::SetCatalog(result_type, type_entry);
562
+ return result_type;
563
+ }
564
+
555
565
  LogicalType Catalog::GetType(ClientContext &context, const string &catalog_name, const string &schema,
556
566
  const string &name) {
557
- CatalogEntry *entry;
558
- entry = GetEntry(context, CatalogType::TYPE_ENTRY, catalog_name, schema, name, true);
559
- if (!entry) {
560
- // look in the system catalog
561
- entry = GetEntry(context, CatalogType::TYPE_ENTRY, SYSTEM_CATALOG, schema, name, true);
562
- if (!entry) {
563
- // repeat the search to get the error
564
- GetEntry(context, CatalogType::TYPE_ENTRY, catalog_name, schema, name);
565
- throw InternalException("Catalog::GetType - second type lookup somehow succeeded!?");
566
- }
567
- }
568
- auto type_entry = (TypeCatalogEntry *)entry;
567
+ auto type_entry = Catalog::GetEntry<TypeCatalogEntry>(context, catalog_name, schema, name);
569
568
  auto result_type = type_entry->user_type;
570
569
  LogicalType::SetCatalog(result_type, type_entry);
571
570
  return result_type;
@@ -286,7 +286,7 @@ unique_ptr<CatalogEntry> DuckTableEntry::AddColumn(ClientContext &context, AddCo
286
286
  for (auto &constraint : constraints) {
287
287
  create_info->constraints.push_back(constraint->Copy());
288
288
  }
289
- Binder::BindLogicalType(context, info.new_column.TypeMutable(), catalog->GetName(), schema->name);
289
+ Binder::BindLogicalType(context, info.new_column.TypeMutable(), catalog, schema->name);
290
290
  info.new_column.SetOid(columns.LogicalColumnCount());
291
291
  info.new_column.SetStorageOid(columns.PhysicalColumnCount());
292
292
  auto col = info.new_column.Copy();
@@ -590,10 +590,18 @@ void BoxRenderer::Render(ClientContext &context, const vector<string> &names, co
590
590
  bottom_rows = rows_to_render - top_rows;
591
591
  }
592
592
  auto row_count_str = to_string(row_count) + " rows";
593
+ bool has_limited_rows = config.limit > 0 && row_count == config.limit;
594
+ if (has_limited_rows) {
595
+ row_count_str = "? rows";
596
+ }
593
597
  string shown_str;
594
598
  bool has_hidden_rows = top_rows < row_count;
595
599
  if (has_hidden_rows) {
596
- shown_str = "(" + to_string(top_rows + bottom_rows) + " shown)";
600
+ shown_str = "(";
601
+ if (has_limited_rows) {
602
+ shown_str += ">" + to_string(config.limit - 1) + " rows, ";
603
+ }
604
+ shown_str += to_string(top_rows + bottom_rows) + " shown)";
597
605
  }
598
606
  auto minimum_row_length = MaxValue<idx_t>(row_count_str.size(), shown_str.size()) + 4;
599
607
 
@@ -10,7 +10,7 @@ CompressedFile::CompressedFile(CompressedFileSystem &fs, unique_ptr<FileHandle>
10
10
  }
11
11
 
12
12
  CompressedFile::~CompressedFile() {
13
- Close();
13
+ CompressedFile::Close();
14
14
  }
15
15
 
16
16
  void CompressedFile::Initialize(bool write) {
@@ -43,6 +43,8 @@ string RelationTypeToString(RelationType type) {
43
43
  return "UPDATE_RELATION";
44
44
  case RelationType::WRITE_CSV_RELATION:
45
45
  return "WRITE_CSV_RELATION";
46
+ case RelationType::WRITE_PARQUET_RELATION:
47
+ return "WRITE_PARQUET_RELATION";
46
48
  case RelationType::READ_CSV_RELATION:
47
49
  return "READ_CSV_RELATION";
48
50
  case RelationType::SUBQUERY_RELATION:
@@ -90,7 +90,7 @@ MiniZStreamWrapper::~MiniZStreamWrapper() {
90
90
  return;
91
91
  }
92
92
  try {
93
- Close();
93
+ MiniZStreamWrapper::Close();
94
94
  } catch (...) {
95
95
  }
96
96
  }
@@ -123,7 +123,7 @@ public:
123
123
  UnixFileHandle(FileSystem &file_system, string path, int fd) : FileHandle(file_system, std::move(path)), fd(fd) {
124
124
  }
125
125
  ~UnixFileHandle() override {
126
- Close();
126
+ UnixFileHandle::Close();
127
127
  }
128
128
 
129
129
  int fd;
@@ -22,7 +22,7 @@ void RowOperations::InitializeStates(RowLayout &layout, Vector &addresses, const
22
22
  auto &offsets = layout.GetOffsets();
23
23
  auto aggr_idx = layout.ColumnCount();
24
24
 
25
- for (auto &aggr : layout.GetAggregates()) {
25
+ for (const auto &aggr : layout.GetAggregates()) {
26
26
  for (idx_t i = 0; i < count; ++i) {
27
27
  auto row_idx = sel.get_index(i);
28
28
  auto row = pointers[row_idx];
@@ -38,7 +38,7 @@ void RowOperations::DestroyStates(RowLayout &layout, Vector &addresses, idx_t co
38
38
  }
39
39
  // Move to the first aggregate state
40
40
  VectorOperations::AddInPlace(addresses, layout.GetAggrOffset(), count);
41
- for (auto &aggr : layout.GetAggregates()) {
41
+ for (const auto &aggr : layout.GetAggregates()) {
42
42
  if (aggr.function.destructor) {
43
43
  aggr.function.destructor(addresses, count);
44
44
  }
@@ -182,8 +182,8 @@ void ColumnDataAllocator::UnswizzlePointers(ChunkManagementState &state, Vector
182
182
  auto strings = FlatVector::GetData<string_t>(result);
183
183
 
184
184
  // find first non-inlined string
185
- auto i = v_offset;
186
- const auto end = v_offset + count;
185
+ uint32_t i = v_offset;
186
+ const uint32_t end = v_offset + count;
187
187
  for (; i < end; i++) {
188
188
  if (!validity.RowIsValid(i)) {
189
189
  continue;
@@ -425,13 +425,18 @@ int64_t Date::Epoch(date_t date) {
425
425
  }
426
426
 
427
427
  int64_t Date::EpochNanoseconds(date_t date) {
428
- return ((int64_t)date.days) * (Interval::MICROS_PER_DAY * 1000);
428
+ int64_t result;
429
+ if (!TryMultiplyOperator::Operation<int64_t, int64_t, int64_t>(date.days, Interval::MICROS_PER_DAY * 1000,
430
+ result)) {
431
+ throw ConversionException("Could not convert DATE (%s) to nanoseconds", Date::ToString(date));
432
+ }
433
+ return result;
429
434
  }
430
435
 
431
436
  int64_t Date::EpochMicroseconds(date_t date) {
432
437
  int64_t result;
433
438
  if (!TryMultiplyOperator::Operation<int64_t, int64_t, int64_t>(date.days, Interval::MICROS_PER_DAY, result)) {
434
- throw ConversionException("Could not convert DATE to microseconds");
439
+ throw ConversionException("Could not convert DATE (%s) to microseconds", Date::ToString(date));
435
440
  }
436
441
  return result;
437
442
  }
@@ -652,7 +652,7 @@ string Vector::ToString(idx_t count) const {
652
652
  return retval;
653
653
  }
654
654
 
655
- void Vector::Print(idx_t count) {
655
+ void Vector::Print(idx_t count) const {
656
656
  Printer::Print(ToString(count));
657
657
  }
658
658
 
@@ -676,7 +676,7 @@ string Vector::ToString() const {
676
676
  return retval;
677
677
  }
678
678
 
679
- void Vector::Print() {
679
+ void Vector::Print() const {
680
680
  Printer::Print(ToString());
681
681
  }
682
682
  // LCOV_EXCL_STOP
@@ -1322,6 +1322,7 @@ void ConstantVector::Reference(Vector &vector, Vector &source, idx_t position, i
1322
1322
  ConstantVector::Reference(*target_entries[i], *source_entries[i], position, count);
1323
1323
  }
1324
1324
  vector.SetVectorType(VectorType::CONSTANT_VECTOR);
1325
+ vector.validity.Set(0, true);
1325
1326
  break;
1326
1327
  }
1327
1328
  default:
@@ -7,7 +7,7 @@
7
7
  namespace duckdb {
8
8
 
9
9
  VirtualFileSystem::VirtualFileSystem() : default_fs(FileSystem::CreateLocal()) {
10
- RegisterSubSystem(FileCompressionType::GZIP, make_unique<GZipFileSystem>());
10
+ VirtualFileSystem::RegisterSubSystem(FileCompressionType::GZIP, make_unique<GZipFileSystem>());
11
11
  }
12
12
 
13
13
  unique_ptr<FileHandle> VirtualFileSystem::OpenFile(const string &path, uint8_t flags, FileLockType lock,
@@ -27,7 +27,7 @@ ART::ART(const vector<column_t> &column_ids, TableIOManager &table_io_manager,
27
27
  tree = nullptr;
28
28
  if (block_id != DConstants::INVALID_INDEX) {
29
29
  tree = Node::Deserialize(*this, block_id, block_offset);
30
- Verify();
30
+ ART::Verify();
31
31
  }
32
32
  serialized_data_pointer = BlockPointer(block_id, block_offset);
33
33
 
@@ -58,7 +58,7 @@ ART::~ART() {
58
58
  if (!tree) {
59
59
  return;
60
60
  }
61
- Verify();
61
+ ART::Verify();
62
62
  if (track_memory) {
63
63
  buffer_manager.DecreaseUsedMemory(memory_size);
64
64
  }
@@ -70,7 +70,7 @@ ART::~ART() {
70
70
  // Initialize Predicate Scans
71
71
  //===--------------------------------------------------------------------===//
72
72
 
73
- unique_ptr<IndexScanState> ART::InitializeScanSinglePredicate(Transaction &transaction, Value value,
73
+ unique_ptr<IndexScanState> ART::InitializeScanSinglePredicate(const Transaction &transaction, const Value &value,
74
74
  ExpressionType expression_type) {
75
75
  auto result = make_unique<ARTIndexScanState>();
76
76
  result->values[0] = value;
@@ -78,8 +78,8 @@ unique_ptr<IndexScanState> ART::InitializeScanSinglePredicate(Transaction &trans
78
78
  return std::move(result);
79
79
  }
80
80
 
81
- unique_ptr<IndexScanState> ART::InitializeScanTwoPredicates(Transaction &transaction, Value low_value,
82
- ExpressionType low_expression_type, Value high_value,
81
+ unique_ptr<IndexScanState> ART::InitializeScanTwoPredicates(Transaction &transaction, const Value &low_value,
82
+ ExpressionType low_expression_type, const Value &high_value,
83
83
  ExpressionType high_expression_type) {
84
84
  auto result = make_unique<ARTIndexScanState>();
85
85
  result->values[0] = low_value;
@@ -444,7 +444,6 @@ void ScanStructure::Next(DataChunk &keys, DataChunk &left, DataChunk &result) {
444
444
  if (finished) {
445
445
  return;
446
446
  }
447
-
448
447
  switch (ht.join_type) {
449
448
  case JoinType::INNER:
450
449
  case JoinType::RIGHT:
@@ -823,10 +822,10 @@ void ScanStructure::NextSingleJoin(DataChunk &keys, DataChunk &input, DataChunk
823
822
  for (idx_t i = 0; i < ht.build_types.size(); i++) {
824
823
  auto &vector = result.data[input.ColumnCount() + i];
825
824
  // set NULL entries for every entry that was not found
826
- auto &mask = FlatVector::Validity(vector);
827
- mask.SetAllInvalid(input.size());
828
- for (idx_t j = 0; j < result_count; j++) {
829
- mask.SetValid(result_sel.get_index(j));
825
+ for (idx_t j = 0; j < input.size(); j++) {
826
+ if (!found_match[j]) {
827
+ FlatVector::SetNull(vector, j, true);
828
+ }
830
829
  }
831
830
  // for the remaining values we fetch the values
832
831
  GatherResult(vector, result_sel, result_sel, result_count, i + ht.condition_types.size());
@@ -70,7 +70,9 @@ SinkResultType PhysicalUpdate::Sink(ExecutionContext &context, GlobalSinkState &
70
70
  // update data in the base table
71
71
  // the row ids are given to us as the last column of the child chunk
72
72
  auto &row_ids = chunk.data[chunk.ColumnCount() - 1];
73
+ update_chunk.Reset();
73
74
  update_chunk.SetCardinality(chunk);
75
+
74
76
  for (idx_t i = 0; i < expressions.size(); i++) {
75
77
  if (expressions[i]->type == ExpressionType::VALUE_DEFAULT) {
76
78
  // default expression, set to the default value of the column