duckdb 0.7.2-dev225.0 → 0.7.2-dev314.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 (131) hide show
  1. package/package.json +1 -1
  2. package/src/duckdb/extension/parquet/column_reader.cpp +5 -6
  3. package/src/duckdb/extension/parquet/include/column_reader.hpp +1 -2
  4. package/src/duckdb/extension/parquet/include/generated_column_reader.hpp +1 -11
  5. package/src/duckdb/extension/parquet/parquet_statistics.cpp +26 -32
  6. package/src/duckdb/src/common/sort/sort_state.cpp +5 -7
  7. package/src/duckdb/src/execution/column_binding_resolver.cpp +6 -0
  8. package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +4 -5
  9. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +1 -1
  10. package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +2 -3
  11. package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +32 -6
  12. package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +15 -15
  13. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +18 -12
  14. package/src/duckdb/src/function/aggregate/distributive/bitstring_agg.cpp +6 -13
  15. package/src/duckdb/src/function/aggregate/distributive/count.cpp +2 -4
  16. package/src/duckdb/src/function/aggregate/distributive/sum.cpp +11 -13
  17. package/src/duckdb/src/function/scalar/date/date_diff.cpp +0 -1
  18. package/src/duckdb/src/function/scalar/date/date_part.cpp +17 -25
  19. package/src/duckdb/src/function/scalar/date/date_sub.cpp +0 -1
  20. package/src/duckdb/src/function/scalar/date/date_trunc.cpp +10 -14
  21. package/src/duckdb/src/function/scalar/generic/stats.cpp +2 -4
  22. package/src/duckdb/src/function/scalar/list/flatten.cpp +5 -12
  23. package/src/duckdb/src/function/scalar/list/list_concat.cpp +3 -8
  24. package/src/duckdb/src/function/scalar/list/list_extract.cpp +5 -12
  25. package/src/duckdb/src/function/scalar/list/list_value.cpp +5 -9
  26. package/src/duckdb/src/function/scalar/math/numeric.cpp +14 -17
  27. package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +27 -34
  28. package/src/duckdb/src/function/scalar/string/caseconvert.cpp +2 -6
  29. package/src/duckdb/src/function/scalar/string/instr.cpp +2 -6
  30. package/src/duckdb/src/function/scalar/string/length.cpp +2 -6
  31. package/src/duckdb/src/function/scalar/string/like.cpp +2 -6
  32. package/src/duckdb/src/function/scalar/string/substring.cpp +2 -6
  33. package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +4 -9
  34. package/src/duckdb/src/function/scalar/struct/struct_insert.cpp +10 -13
  35. package/src/duckdb/src/function/scalar/struct/struct_pack.cpp +5 -6
  36. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  37. package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +1 -1
  38. package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +12 -3
  39. package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +2 -2
  40. package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +2 -0
  41. package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +3 -2
  42. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +2 -2
  43. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_fetch.hpp +1 -1
  44. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +1 -1
  45. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_compress.hpp +2 -2
  46. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_fetch.hpp +1 -1
  47. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp +1 -1
  48. package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +5 -2
  49. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -1
  50. package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +93 -31
  51. package/src/duckdb/src/include/duckdb/storage/statistics/column_statistics.hpp +22 -3
  52. package/src/duckdb/src/include/duckdb/storage/statistics/distinct_statistics.hpp +6 -6
  53. package/src/duckdb/src/include/duckdb/storage/statistics/list_stats.hpp +41 -0
  54. package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats.hpp +157 -0
  55. package/src/duckdb/src/include/duckdb/storage/statistics/segment_statistics.hpp +2 -7
  56. package/src/duckdb/src/include/duckdb/storage/statistics/string_stats.hpp +74 -0
  57. package/src/duckdb/src/include/duckdb/storage/statistics/struct_stats.hpp +42 -0
  58. package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +2 -3
  59. package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +2 -2
  60. package/src/duckdb/src/include/duckdb/storage/table/persistent_table_data.hpp +2 -1
  61. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +4 -3
  62. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +3 -2
  63. package/src/duckdb/src/include/duckdb/storage/table/table_statistics.hpp +5 -0
  64. package/src/duckdb/src/main/config.cpp +66 -1
  65. package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +0 -1
  66. package/src/duckdb/src/optimizer/statistics/expression/propagate_aggregate.cpp +9 -3
  67. package/src/duckdb/src/optimizer/statistics/expression/propagate_and_compress.cpp +6 -7
  68. package/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +14 -11
  69. package/src/duckdb/src/optimizer/statistics/expression/propagate_columnref.cpp +1 -1
  70. package/src/duckdb/src/optimizer/statistics/expression/propagate_comparison.cpp +13 -15
  71. package/src/duckdb/src/optimizer/statistics/expression/propagate_conjunction.cpp +0 -1
  72. package/src/duckdb/src/optimizer/statistics/expression/propagate_constant.cpp +3 -75
  73. package/src/duckdb/src/optimizer/statistics/expression/propagate_function.cpp +7 -2
  74. package/src/duckdb/src/optimizer/statistics/expression/propagate_operator.cpp +10 -0
  75. package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +2 -3
  76. package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +28 -31
  77. package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +4 -5
  78. package/src/duckdb/src/optimizer/statistics/operator/propagate_set_operation.cpp +3 -3
  79. package/src/duckdb/src/optimizer/statistics_propagator.cpp +1 -1
  80. package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +4 -0
  81. package/src/duckdb/src/planner/bind_context.cpp +16 -0
  82. package/src/duckdb/src/planner/binder/query_node/plan_select_node.cpp +0 -1
  83. package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +9 -0
  84. package/src/duckdb/src/planner/binder.cpp +2 -1
  85. package/src/duckdb/src/planner/bound_result_modifier.cpp +1 -1
  86. package/src/duckdb/src/planner/expression/bound_window_expression.cpp +1 -1
  87. package/src/duckdb/src/planner/filter/constant_filter.cpp +4 -6
  88. package/src/duckdb/src/storage/checkpoint/row_group_writer.cpp +1 -1
  89. package/src/duckdb/src/storage/checkpoint/table_data_reader.cpp +1 -4
  90. package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +4 -4
  91. package/src/duckdb/src/storage/compression/bitpacking.cpp +3 -3
  92. package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +3 -3
  93. package/src/duckdb/src/storage/compression/numeric_constant.cpp +9 -10
  94. package/src/duckdb/src/storage/compression/patas.cpp +1 -1
  95. package/src/duckdb/src/storage/compression/rle.cpp +2 -2
  96. package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +5 -5
  97. package/src/duckdb/src/storage/data_table.cpp +4 -6
  98. package/src/duckdb/src/storage/statistics/base_statistics.cpp +373 -128
  99. package/src/duckdb/src/storage/statistics/column_statistics.cpp +58 -3
  100. package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +4 -9
  101. package/src/duckdb/src/storage/statistics/list_stats.cpp +117 -0
  102. package/src/duckdb/src/storage/statistics/numeric_stats.cpp +529 -0
  103. package/src/duckdb/src/storage/statistics/segment_statistics.cpp +2 -11
  104. package/src/duckdb/src/storage/statistics/string_stats.cpp +273 -0
  105. package/src/duckdb/src/storage/statistics/struct_stats.cpp +131 -0
  106. package/src/duckdb/src/storage/storage_info.cpp +1 -1
  107. package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +3 -4
  108. package/src/duckdb/src/storage/table/column_data.cpp +16 -14
  109. package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +2 -3
  110. package/src/duckdb/src/storage/table/column_segment.cpp +6 -8
  111. package/src/duckdb/src/storage/table/list_column_data.cpp +7 -11
  112. package/src/duckdb/src/storage/table/row_group.cpp +24 -23
  113. package/src/duckdb/src/storage/table/row_group_collection.cpp +12 -12
  114. package/src/duckdb/src/storage/table/standard_column_data.cpp +6 -6
  115. package/src/duckdb/src/storage/table/struct_column_data.cpp +15 -16
  116. package/src/duckdb/src/storage/table/table_statistics.cpp +27 -7
  117. package/src/duckdb/src/storage/table/update_segment.cpp +10 -12
  118. package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +923 -919
  119. package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +2 -0
  120. package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +15684 -15571
  121. package/src/duckdb/ub_src_storage_statistics.cpp +4 -6
  122. package/src/duckdb/src/include/duckdb/storage/statistics/list_statistics.hpp +0 -36
  123. package/src/duckdb/src/include/duckdb/storage/statistics/numeric_statistics.hpp +0 -75
  124. package/src/duckdb/src/include/duckdb/storage/statistics/string_statistics.hpp +0 -49
  125. package/src/duckdb/src/include/duckdb/storage/statistics/struct_statistics.hpp +0 -36
  126. package/src/duckdb/src/include/duckdb/storage/statistics/validity_statistics.hpp +0 -45
  127. package/src/duckdb/src/storage/statistics/list_statistics.cpp +0 -94
  128. package/src/duckdb/src/storage/statistics/numeric_statistics.cpp +0 -307
  129. package/src/duckdb/src/storage/statistics/string_statistics.cpp +0 -220
  130. package/src/duckdb/src/storage/statistics/struct_statistics.cpp +0 -108
  131. package/src/duckdb/src/storage/statistics/validity_statistics.cpp +0 -91
@@ -5,6 +5,7 @@
5
5
  #include "duckdb/common/vector_operations/vector_operations.hpp"
6
6
  #include "duckdb/common/serializer/buffered_serializer.hpp"
7
7
  #include "duckdb/storage/table/column_checkpoint_state.hpp"
8
+ #include "duckdb/storage/table/table_statistics.hpp"
8
9
 
9
10
  namespace duckdb {
10
11
 
@@ -40,14 +41,13 @@ unique_ptr<RowGroupWriter> SingleFileTableDataWriter::GetRowGroupWriter(RowGroup
40
41
  return make_unique<SingleFileRowGroupWriter>(table, checkpoint_manager.partial_block_manager, table_data_writer);
41
42
  }
42
43
 
43
- void SingleFileTableDataWriter::FinalizeTable(vector<unique_ptr<BaseStatistics>> &&global_stats, DataTableInfo *info) {
44
+ void SingleFileTableDataWriter::FinalizeTable(TableStatistics &&global_stats, DataTableInfo *info) {
44
45
  // store the current position in the metadata writer
45
46
  // this is where the row groups for this table start
46
47
  auto pointer = table_data_writer.GetBlockPointer();
47
48
 
48
- for (auto &stats : global_stats) {
49
- stats->Serialize(table_data_writer);
50
- }
49
+ global_stats.Serialize(table_data_writer);
50
+
51
51
  // now start writing the row group pointers to disk
52
52
  table_data_writer.Write<uint64_t>(row_group_pointers.size());
53
53
  for (auto &row_group_pointer : row_group_pointers) {
@@ -6,7 +6,7 @@
6
6
  #include "duckdb/function/compression_function.hpp"
7
7
  #include "duckdb/main/config.hpp"
8
8
  #include "duckdb/storage/buffer_manager.hpp"
9
- #include "duckdb/storage/statistics/numeric_statistics.hpp"
9
+
10
10
  #include "duckdb/storage/table/column_data_checkpointer.hpp"
11
11
  #include "duckdb/storage/table/column_segment.hpp"
12
12
  #include "duckdb/common/operator/subtract.hpp"
@@ -455,8 +455,8 @@ public:
455
455
  state->current_segment->count += count;
456
456
 
457
457
  if (WRITE_STATISTICS && !state->state.all_invalid) {
458
- NumericStatistics::Update<T>(state->current_segment->stats, state->state.minimum);
459
- NumericStatistics::Update<T>(state->current_segment->stats, state->state.maximum);
458
+ NumericStats::Update<T>(state->current_segment->stats.statistics, state->state.minimum);
459
+ NumericStats::Update<T>(state->current_segment->stats.statistics, state->state.maximum);
460
460
  }
461
461
  }
462
462
  };
@@ -5,7 +5,7 @@
5
5
  #include "duckdb/storage/buffer_manager.hpp"
6
6
  #include "duckdb/storage/checkpoint/write_overflow_strings_to_disk.hpp"
7
7
  #include "duckdb/storage/segment/uncompressed.hpp"
8
- #include "duckdb/storage/statistics/numeric_statistics.hpp"
8
+
9
9
  #include "duckdb/storage/table/append_state.hpp"
10
10
  #include "duckdb/storage/table/column_data_checkpointer.hpp"
11
11
  #include "duckdb/storage/table/column_segment.hpp"
@@ -192,7 +192,7 @@ struct StandardFixedSizeAppend {
192
192
  auto target_idx = target_offset + i;
193
193
  bool is_null = !adata.validity.RowIsValid(source_idx);
194
194
  if (!is_null) {
195
- NumericStatistics::Update<T>(stats, sdata[source_idx]);
195
+ NumericStats::Update<T>(stats.statistics, sdata[source_idx]);
196
196
  tdata[target_idx] = sdata[source_idx];
197
197
  } else {
198
198
  // we insert a NullValue<T> in the null gap for debuggability
@@ -204,7 +204,7 @@ struct StandardFixedSizeAppend {
204
204
  for (idx_t i = 0; i < count; i++) {
205
205
  auto source_idx = adata.sel->get_index(offset + i);
206
206
  auto target_idx = target_offset + i;
207
- NumericStatistics::Update<T>(stats, sdata[source_idx]);
207
+ NumericStats::Update<T>(stats.statistics, sdata[source_idx]);
208
208
  tdata[target_idx] = sdata[source_idx];
209
209
  }
210
210
  }
@@ -1,8 +1,7 @@
1
1
  #include "duckdb/function/compression/compression.hpp"
2
2
  #include "duckdb/storage/buffer_manager.hpp"
3
3
  #include "duckdb/common/types/vector.hpp"
4
- #include "duckdb/storage/statistics/numeric_statistics.hpp"
5
- #include "duckdb/storage/statistics/validity_statistics.hpp"
4
+
6
5
  #include "duckdb/storage/table/column_segment.hpp"
7
6
  #include "duckdb/function/compression_function.hpp"
8
7
  #include "duckdb/storage/segment/uncompressed.hpp"
@@ -20,8 +19,8 @@ unique_ptr<SegmentScanState> ConstantInitScan(ColumnSegment &segment) {
20
19
  // Scan Partial
21
20
  //===--------------------------------------------------------------------===//
22
21
  void ConstantFillFunctionValidity(ColumnSegment &segment, Vector &result, idx_t start_idx, idx_t count) {
23
- auto &validity = (ValidityStatistics &)*segment.stats.statistics;
24
- if (validity.has_null) {
22
+ auto &stats = segment.stats.statistics;
23
+ if (stats.CanHaveNull()) {
25
24
  auto &mask = FlatVector::Validity(result);
26
25
  for (idx_t i = 0; i < count; i++) {
27
26
  mask.SetInvalid(start_idx + i);
@@ -31,10 +30,10 @@ void ConstantFillFunctionValidity(ColumnSegment &segment, Vector &result, idx_t
31
30
 
32
31
  template <class T>
33
32
  void ConstantFillFunction(ColumnSegment &segment, Vector &result, idx_t start_idx, idx_t count) {
34
- auto &nstats = (NumericStatistics &)*segment.stats.statistics;
33
+ auto &nstats = segment.stats.statistics;
35
34
 
36
35
  auto data = FlatVector::GetData<T>(result);
37
- auto constant_value = nstats.min.GetValueUnsafe<T>();
36
+ auto constant_value = NumericStats::GetMinUnsafe<T>(nstats);
38
37
  for (idx_t i = 0; i < count; i++) {
39
38
  data[start_idx + i] = constant_value;
40
39
  }
@@ -55,8 +54,8 @@ void ConstantScanPartial(ColumnSegment &segment, ColumnScanState &state, idx_t s
55
54
  // Scan base data
56
55
  //===--------------------------------------------------------------------===//
57
56
  void ConstantScanFunctionValidity(ColumnSegment &segment, ColumnScanState &state, idx_t scan_count, Vector &result) {
58
- auto &validity = (ValidityStatistics &)*segment.stats.statistics;
59
- if (validity.has_null) {
57
+ auto &stats = segment.stats.statistics;
58
+ if (stats.CanHaveNull()) {
60
59
  if (result.GetVectorType() == VectorType::CONSTANT_VECTOR) {
61
60
  result.SetVectorType(VectorType::CONSTANT_VECTOR);
62
61
  ConstantVector::SetNull(result, true);
@@ -69,10 +68,10 @@ void ConstantScanFunctionValidity(ColumnSegment &segment, ColumnScanState &state
69
68
 
70
69
  template <class T>
71
70
  void ConstantScanFunction(ColumnSegment &segment, ColumnScanState &state, idx_t scan_count, Vector &result) {
72
- auto &nstats = (NumericStatistics &)*segment.stats.statistics;
71
+ auto &nstats = segment.stats.statistics;
73
72
 
74
73
  auto data = FlatVector::GetData<T>(result);
75
- data[0] = nstats.min.GetValueUnsafe<T>();
74
+ data[0] = NumericStats::GetMinUnsafe<T>(nstats);
76
75
  result.SetVectorType(VectorType::CONSTANT_VECTOR);
77
76
  }
78
77
 
@@ -10,7 +10,7 @@
10
10
  #include "duckdb/function/compression_function.hpp"
11
11
  #include "duckdb/main/config.hpp"
12
12
  #include "duckdb/storage/buffer_manager.hpp"
13
- #include "duckdb/storage/statistics/numeric_statistics.hpp"
13
+
14
14
  #include "duckdb/storage/table/column_data_checkpointer.hpp"
15
15
  #include "duckdb/storage/table/column_segment.hpp"
16
16
  #include "duckdb/common/operator/subtract.hpp"
@@ -1,5 +1,5 @@
1
1
  #include "duckdb/function/compression/compression.hpp"
2
- #include "duckdb/storage/statistics/numeric_statistics.hpp"
2
+
3
3
  #include "duckdb/storage/table/column_segment.hpp"
4
4
  #include "duckdb/function/compression_function.hpp"
5
5
  #include "duckdb/main/config.hpp"
@@ -175,7 +175,7 @@ struct RLECompressState : public CompressionState {
175
175
 
176
176
  // update meta data
177
177
  if (WRITE_STATISTICS && !is_null) {
178
- NumericStatistics::Update<T>(current_segment->stats, value);
178
+ NumericStats::Update<T>(current_segment->stats.statistics, value);
179
179
  }
180
180
  current_segment->count += count;
181
181
 
@@ -2,7 +2,7 @@
2
2
  #include "duckdb/storage/buffer_manager.hpp"
3
3
  #include "duckdb/common/types/vector.hpp"
4
4
  #include "duckdb/storage/table/append_state.hpp"
5
- #include "duckdb/storage/statistics/validity_statistics.hpp"
5
+
6
6
  #include "duckdb/common/types/null_value.hpp"
7
7
  #include "duckdb/storage/table/column_segment.hpp"
8
8
  #include "duckdb/function/compression_function.hpp"
@@ -410,14 +410,14 @@ unique_ptr<CompressedSegmentState> ValidityInitSegment(ColumnSegment &segment, b
410
410
  idx_t ValidityAppend(CompressionAppendState &append_state, ColumnSegment &segment, SegmentStatistics &stats,
411
411
  UnifiedVectorFormat &data, idx_t offset, idx_t vcount) {
412
412
  D_ASSERT(segment.GetBlockOffset() == 0);
413
- auto &validity_stats = (ValidityStatistics &)*stats.statistics;
413
+ auto &validity_stats = stats.statistics;
414
414
 
415
415
  auto max_tuples = segment.SegmentSize() / ValidityMask::STANDARD_MASK_SIZE * STANDARD_VECTOR_SIZE;
416
416
  idx_t append_count = MinValue<idx_t>(vcount, max_tuples - segment.count);
417
417
  if (data.validity.AllValid()) {
418
418
  // no null values: skip append
419
419
  segment.count += append_count;
420
- validity_stats.has_no_null = true;
420
+ validity_stats.SetHasNoNull();
421
421
  return append_count;
422
422
  }
423
423
 
@@ -426,9 +426,9 @@ idx_t ValidityAppend(CompressionAppendState &append_state, ColumnSegment &segmen
426
426
  auto idx = data.sel->get_index(offset + i);
427
427
  if (!data.validity.RowIsValidUnsafe(idx)) {
428
428
  mask.SetInvalidUnsafe(segment.count + i);
429
- validity_stats.has_null = true;
429
+ validity_stats.SetHasNull();
430
430
  } else {
431
- validity_stats.has_no_null = true;
431
+ validity_stats.SetHasNoNull();
432
432
  }
433
433
  }
434
434
  segment.count += append_count;
@@ -1223,9 +1223,9 @@ unique_ptr<BaseStatistics> DataTable::GetStatistics(ClientContext &context, colu
1223
1223
  return row_groups->CopyStats(column_id);
1224
1224
  }
1225
1225
 
1226
- void DataTable::SetStatistics(column_t column_id, const std::function<void(BaseStatistics &)> &set_fun) {
1226
+ void DataTable::SetDistinct(column_t column_id, unique_ptr<DistinctStatistics> distinct_stats) {
1227
1227
  D_ASSERT(column_id != COLUMN_IDENTIFIER_ROW_ID);
1228
- row_groups->SetStatistics(column_id, set_fun);
1228
+ row_groups->SetDistinct(column_id, std::move(distinct_stats));
1229
1229
  }
1230
1230
 
1231
1231
  //===--------------------------------------------------------------------===//
@@ -1234,10 +1234,8 @@ void DataTable::SetStatistics(column_t column_id, const std::function<void(BaseS
1234
1234
  void DataTable::Checkpoint(TableDataWriter &writer) {
1235
1235
  // checkpoint each individual row group
1236
1236
  // FIXME: we might want to combine adjacent row groups in case they have had deletions...
1237
- vector<unique_ptr<BaseStatistics>> global_stats;
1238
- for (idx_t i = 0; i < column_definitions.size(); i++) {
1239
- global_stats.push_back(row_groups->CopyStats(i));
1240
- }
1237
+ TableStatistics global_stats;
1238
+ row_groups->CopyStats(global_stats);
1241
1239
 
1242
1240
  row_groups->Checkpoint(writer, global_stats);
1243
1241