duckdb 0.7.2-dev1034.0 → 0.7.2-dev1146.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 (96) hide show
  1. package/package.json +1 -1
  2. package/src/duckdb/extension/icu/third_party/icu/stubdata/stubdata.cpp +1 -1
  3. package/src/duckdb/extension/parquet/parquet-extension.cpp +2 -1
  4. package/src/duckdb/src/common/hive_partitioning.cpp +3 -1
  5. package/src/duckdb/src/common/progress_bar/progress_bar.cpp +7 -0
  6. package/src/duckdb/src/common/serializer/enum_serializer.cpp +6 -6
  7. package/src/duckdb/src/common/sort/comparators.cpp +14 -5
  8. package/src/duckdb/src/common/types/column_data_collection_segment.cpp +1 -4
  9. package/src/duckdb/src/common/types/interval.cpp +0 -41
  10. package/src/duckdb/src/common/types/list_segment.cpp +658 -0
  11. package/src/duckdb/src/common/types/string_heap.cpp +1 -1
  12. package/src/duckdb/src/common/types/string_type.cpp +1 -1
  13. package/src/duckdb/src/common/types/validity_mask.cpp +24 -7
  14. package/src/duckdb/src/common/types/vector.cpp +3 -7
  15. package/src/duckdb/src/common/value_operations/comparison_operations.cpp +14 -22
  16. package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +10 -10
  17. package/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +11 -10
  18. package/src/duckdb/src/execution/expression_executor/execute_comparison.cpp +2 -2
  19. package/src/duckdb/src/execution/index/art/art.cpp +13 -0
  20. package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +1 -1
  21. package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +2 -0
  22. package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +1 -0
  23. package/src/duckdb/src/execution/operator/join/physical_join.cpp +0 -3
  24. package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +5 -1
  25. package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +18 -5
  26. package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +3 -0
  27. package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +2 -1
  28. package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +1 -3
  29. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +1 -0
  30. package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +0 -4
  31. package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +1 -0
  32. package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +1 -1
  33. package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +2 -1
  34. package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +18 -10
  35. package/src/duckdb/src/function/aggregate/nested/list.cpp +6 -712
  36. package/src/duckdb/src/function/cast_rules.cpp +9 -4
  37. package/src/duckdb/src/function/scalar/list/list_sort.cpp +25 -18
  38. package/src/duckdb/src/function/table/read_csv.cpp +5 -0
  39. package/src/duckdb/src/function/table/table_scan.cpp +8 -11
  40. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  41. package/src/duckdb/src/include/duckdb/common/helper.hpp +1 -1
  42. package/src/duckdb/src/include/duckdb/common/operator/comparison_operators.hpp +45 -149
  43. package/src/duckdb/src/include/duckdb/common/progress_bar/progress_bar.hpp +2 -0
  44. package/src/duckdb/src/include/duckdb/common/types/interval.hpp +39 -3
  45. package/src/duckdb/src/include/duckdb/common/types/list_segment.hpp +70 -0
  46. package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +73 -3
  47. package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +4 -1
  48. package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +1 -12
  49. package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +4 -0
  50. package/src/duckdb/src/include/duckdb/main/client_config.hpp +2 -0
  51. package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +1 -0
  52. package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp +1 -0
  53. package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +0 -2
  54. package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -0
  55. package/src/duckdb/src/include/duckdb/storage/index.hpp +1 -1
  56. package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +1 -1
  57. package/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +18 -7
  58. package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +0 -3
  59. package/src/duckdb/src/include/duckdb/storage/table/column_segment_tree.hpp +18 -0
  60. package/src/duckdb/src/include/duckdb/storage/table/persistent_table_data.hpp +0 -1
  61. package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +35 -43
  62. package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +18 -5
  63. package/src/duckdb/src/include/duckdb/storage/table/row_group_segment_tree.hpp +2 -4
  64. package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +12 -29
  65. package/src/duckdb/src/include/duckdb/storage/table/segment_base.hpp +2 -3
  66. package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +11 -1
  67. package/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +0 -4
  68. package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +4 -1
  69. package/src/duckdb/src/include/duckdb.h +21 -0
  70. package/src/duckdb/src/main/capi/table_function-c.cpp +23 -0
  71. package/src/duckdb/src/main/settings/settings.cpp +20 -8
  72. package/src/duckdb/src/optimizer/filter_combiner.cpp +2 -5
  73. package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +2 -0
  74. package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +1 -0
  75. package/src/duckdb/src/parallel/meta_pipeline.cpp +0 -3
  76. package/src/duckdb/src/parser/transform/expression/transform_function.cpp +22 -0
  77. package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +1 -0
  78. package/src/duckdb/src/storage/compression/bitpacking.cpp +1 -1
  79. package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +2 -1
  80. package/src/duckdb/src/storage/compression/numeric_constant.cpp +1 -1
  81. package/src/duckdb/src/storage/compression/rle.cpp +1 -0
  82. package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +1 -1
  83. package/src/duckdb/src/storage/data_table.cpp +3 -3
  84. package/src/duckdb/src/storage/local_storage.cpp +7 -0
  85. package/src/duckdb/src/storage/storage_info.cpp +1 -1
  86. package/src/duckdb/src/storage/table/column_data.cpp +75 -18
  87. package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +3 -1
  88. package/src/duckdb/src/storage/table/column_segment.cpp +17 -31
  89. package/src/duckdb/src/storage/table/list_column_data.cpp +9 -12
  90. package/src/duckdb/src/storage/table/row_group.cpp +200 -136
  91. package/src/duckdb/src/storage/table/row_group_collection.cpp +75 -45
  92. package/src/duckdb/src/storage/table/scan_state.cpp +31 -38
  93. package/src/duckdb/src/storage/table/standard_column_data.cpp +4 -6
  94. package/src/duckdb/src/storage/table/struct_column_data.cpp +11 -18
  95. package/src/duckdb/src/storage/table/update_segment.cpp +3 -0
  96. package/src/duckdb/ub_src_common_types.cpp +2 -0
@@ -72,12 +72,11 @@ struct ColumnScanState {
72
72
  idx_t last_offset = 0;
73
73
 
74
74
  public:
75
+ void Initialize(const LogicalType &type);
75
76
  //! Move the scan state forward by "count" rows (including all child states)
76
77
  void Next(idx_t count);
77
78
  //! Move ONLY this state forward by "count" rows (i.e. not the child states)
78
79
  void NextInternal(idx_t count);
79
- //! Move the scan state forward by STANDARD_VECTOR_SIZE rows
80
- void NextVector();
81
80
  };
82
81
 
83
82
  struct ColumnFetchState {
@@ -89,39 +88,18 @@ struct ColumnFetchState {
89
88
  BufferHandle &GetOrInsertHandle(ColumnSegment &segment);
90
89
  };
91
90
 
92
- class RowGroupScanState {
91
+ class CollectionScanState {
93
92
  public:
94
- RowGroupScanState(CollectionScanState &parent_p)
95
- : row_group(nullptr), vector_index(0), max_row(0), parent(parent_p) {
96
- }
93
+ CollectionScanState(TableScanState &parent_p);
97
94
 
98
95
  //! The current row_group we are scanning
99
- RowGroup *row_group = nullptr;
96
+ RowGroup *row_group;
100
97
  //! The vector index within the row_group
101
- idx_t vector_index = 0;
102
- //! The maximum row index of this row_group scan
103
- idx_t max_row = 0;
98
+ idx_t vector_index;
99
+ //! The maximum row within the row group
100
+ idx_t max_row_group_row;
104
101
  //! Child column scans
105
102
  unique_ptr<ColumnScanState[]> column_scans;
106
-
107
- public:
108
- const vector<column_t> &GetColumnIds();
109
- TableFilterSet *GetFilters();
110
- AdaptiveFilter *GetAdaptiveFilter();
111
- idx_t GetParentMaxRow();
112
-
113
- private:
114
- //! The parent scan state
115
- CollectionScanState &parent;
116
- };
117
-
118
- class CollectionScanState {
119
- public:
120
- CollectionScanState(TableScanState &parent_p)
121
- : row_group_state(*this), row_groups(nullptr), max_row(0), batch_index(0), parent(parent_p) {};
122
-
123
- //! The row_group scan state
124
- RowGroupScanState row_group_state;
125
103
  //! Row group segment tree
126
104
  RowGroupSegmentTree *row_groups;
127
105
  //! The total maximum row index
@@ -130,6 +108,7 @@ public:
130
108
  idx_t batch_index;
131
109
 
132
110
  public:
111
+ void Initialize(const vector<LogicalType> &types);
133
112
  const vector<column_t> &GetColumnIds();
134
113
  TableFilterSet *GetFilters();
135
114
  AdaptiveFilter *GetAdaptiveFilter();
@@ -167,12 +146,16 @@ private:
167
146
  };
168
147
 
169
148
  struct ParallelCollectionScanState {
149
+ ParallelCollectionScanState();
150
+
170
151
  //! The row group collection we are scanning
171
152
  RowGroupCollection *collection;
172
153
  RowGroup *current_row_group;
173
154
  idx_t vector_index;
174
155
  idx_t max_row;
175
156
  idx_t batch_index;
157
+ atomic<idx_t> processed_rows;
158
+ mutex lock;
176
159
  };
177
160
 
178
161
  struct ParallelTableScanState {
@@ -18,8 +18,6 @@ class SegmentBase {
18
18
  public:
19
19
  SegmentBase(idx_t start, idx_t count) : start(start), count(count), next(nullptr) {
20
20
  }
21
- virtual ~SegmentBase() {
22
- }
23
21
  T *Next() {
24
22
  #ifndef DUCKDB_R_BUILD
25
23
  return next.load();
@@ -33,12 +31,13 @@ public:
33
31
  //! The amount of entries in this storage chunk
34
32
  atomic<idx_t> count;
35
33
  //! The next segment after this one
36
-
37
34
  #ifndef DUCKDB_R_BUILD
38
35
  atomic<T *> next;
39
36
  #else
40
37
  T *next;
41
38
  #endif
39
+ //! The index within the segment tree
40
+ idx_t index;
42
41
  };
43
42
 
44
43
  } // namespace duckdb
@@ -56,7 +56,7 @@ public:
56
56
  if (nodes.empty()) {
57
57
  LoadNextSegment(l);
58
58
  }
59
- return nodes.empty() ? nullptr : nodes[0].node.get();
59
+ return GetRootSegmentInternal();
60
60
  }
61
61
  //! Obtains ownership of the data of the segment tree
62
62
  vector<SegmentNode<T>> MoveSegments(SegmentLock &l) {
@@ -258,6 +258,10 @@ private:
258
258
  mutex node_lock;
259
259
 
260
260
  private:
261
+ T *GetRootSegmentInternal() {
262
+ return nodes.empty() ? nullptr : nodes[0].node.get();
263
+ }
264
+
261
265
  class SegmentIterationHelper {
262
266
  public:
263
267
  explicit SegmentIterationHelper(SegmentTree &tree) : tree(tree) {
@@ -304,6 +308,9 @@ private:
304
308
 
305
309
  //! Load the next segment, if there are any left to load
306
310
  bool LoadNextSegment(SegmentLock &l) {
311
+ if (!SUPPORTS_LAZY_LOADING) {
312
+ return false;
313
+ }
307
314
  if (finished_loading) {
308
315
  return false;
309
316
  }
@@ -317,6 +324,9 @@ private:
317
324
 
318
325
  //! Load all segments, if there are any left to load
319
326
  void LoadAllSegments(SegmentLock &l) {
327
+ if (!SUPPORTS_LAZY_LOADING) {
328
+ return;
329
+ }
320
330
  while (LoadNextSegment(l))
321
331
  ;
322
332
  }
@@ -59,10 +59,6 @@ public:
59
59
  void GetStorageInfo(idx_t row_group_index, vector<idx_t> col_path, TableStorageInfo &result) override;
60
60
 
61
61
  void Verify(RowGroup &parent) override;
62
-
63
- private:
64
- template <bool SCAN_COMMITTED, bool ALLOW_UPDATES>
65
- void TemplatedScan(Transaction *transaction, ColumnScanState &state, Vector &result);
66
62
  };
67
63
 
68
64
  } // namespace duckdb
@@ -9,7 +9,6 @@
9
9
  #pragma once
10
10
 
11
11
  #include "duckdb/storage/table/row_group_collection.hpp"
12
- #include "duckdb/storage/table/scan_state.hpp"
13
12
  #include "duckdb/storage/table/table_index_list.hpp"
14
13
  #include "duckdb/storage/table/table_statistics.hpp"
15
14
 
@@ -18,6 +17,7 @@ class AttachedDatabase;
18
17
  class DataTable;
19
18
  class Transaction;
20
19
  class WriteAheadLog;
20
+ struct LocalAppendState;
21
21
  struct TableAppendState;
22
22
 
23
23
  class OptimisticDataWriter {
@@ -118,6 +118,9 @@ public:
118
118
 
119
119
  public:
120
120
  struct CommitState {
121
+ CommitState();
122
+ ~CommitState();
123
+
121
124
  unordered_map<DataTable *, unique_ptr<TableAppendState>> append_states;
122
125
  };
123
126
 
@@ -1710,6 +1710,16 @@ Adds a parameter to the table function.
1710
1710
  */
1711
1711
  DUCKDB_API void duckdb_table_function_add_parameter(duckdb_table_function table_function, duckdb_logical_type type);
1712
1712
 
1713
+ /*!
1714
+ Adds a named parameter to the table function.
1715
+
1716
+ * table_function: The table function
1717
+ * name: The name of the parameter
1718
+ * type: The type of the parameter to add.
1719
+ */
1720
+ DUCKDB_API void duckdb_table_function_add_named_parameter(duckdb_table_function table_function, const char *name,
1721
+ duckdb_logical_type type);
1722
+
1713
1723
  /*!
1714
1724
  Assigns extra information to the table function that can be fetched during binding, etc.
1715
1725
 
@@ -1818,6 +1828,17 @@ The result must be destroyed with `duckdb_destroy_value`.
1818
1828
  */
1819
1829
  DUCKDB_API duckdb_value duckdb_bind_get_parameter(duckdb_bind_info info, idx_t index);
1820
1830
 
1831
+ /*!
1832
+ Retrieves a named parameter with the given name.
1833
+
1834
+ The result must be destroyed with `duckdb_destroy_value`.
1835
+
1836
+ * info: The info object
1837
+ * name: The name of the parameter
1838
+ * returns: The value of the parameter. Must be destroyed with `duckdb_destroy_value`.
1839
+ */
1840
+ DUCKDB_API duckdb_value duckdb_bind_get_named_parameter(duckdb_bind_info info, const char *name);
1841
+
1821
1842
  /*!
1822
1843
  Sets the user-provided bind data in the bind object. This object can be retrieved again during execution.
1823
1844
 
@@ -208,6 +208,16 @@ void duckdb_table_function_add_parameter(duckdb_table_function function, duckdb_
208
208
  tf->arguments.push_back(*logical_type);
209
209
  }
210
210
 
211
+ void duckdb_table_function_add_named_parameter(duckdb_table_function function, const char *name,
212
+ duckdb_logical_type type) {
213
+ if (!function || !type) {
214
+ return;
215
+ }
216
+ auto tf = (duckdb::TableFunction *)function;
217
+ auto logical_type = (duckdb::LogicalType *)type;
218
+ tf->named_parameters.insert({name, *logical_type});
219
+ }
220
+
211
221
  void duckdb_table_function_set_extra_info(duckdb_table_function function, void *extra_info,
212
222
  duckdb_delete_callback_t destroy) {
213
223
  if (!function) {
@@ -319,6 +329,19 @@ duckdb_value duckdb_bind_get_parameter(duckdb_bind_info info, idx_t index) {
319
329
  return reinterpret_cast<duckdb_value>(new duckdb::Value(bind_info->input.inputs[index]));
320
330
  }
321
331
 
332
+ duckdb_value duckdb_bind_get_named_parameter(duckdb_bind_info info, const char *name) {
333
+ if (!info || !name) {
334
+ return nullptr;
335
+ }
336
+ auto bind_info = (duckdb::CTableInternalBindInfo *)info;
337
+ auto t = bind_info->input.named_parameters.find(name);
338
+ if (t == bind_info->input.named_parameters.end()) {
339
+ return nullptr;
340
+ } else {
341
+ return reinterpret_cast<duckdb_value>(new duckdb::Value(t->second));
342
+ }
343
+ }
344
+
322
345
  void duckdb_bind_set_bind_data(duckdb_bind_info info, void *bind_data, duckdb_delete_callback_t destroy) {
323
346
  if (!info) {
324
347
  return;
@@ -454,11 +454,15 @@ Value CustomExtensionRepository::GetSetting(ClientContext &context) {
454
454
  //===--------------------------------------------------------------------===//
455
455
 
456
456
  void EnableProgressBarSetting::ResetLocal(ClientContext &context) {
457
- ClientConfig::GetConfig(context).enable_progress_bar = ClientConfig().enable_progress_bar;
457
+ auto &config = ClientConfig::GetConfig(context);
458
+ ProgressBar::SystemOverrideCheck(config);
459
+ config.enable_progress_bar = ClientConfig().enable_progress_bar;
458
460
  }
459
461
 
460
462
  void EnableProgressBarSetting::SetLocal(ClientContext &context, const Value &input) {
461
- ClientConfig::GetConfig(context).enable_progress_bar = input.GetValue<bool>();
463
+ auto &config = ClientConfig::GetConfig(context);
464
+ ProgressBar::SystemOverrideCheck(config);
465
+ config.enable_progress_bar = input.GetValue<bool>();
462
466
  }
463
467
 
464
468
  Value EnableProgressBarSetting::GetSetting(ClientContext &context) {
@@ -469,11 +473,15 @@ Value EnableProgressBarSetting::GetSetting(ClientContext &context) {
469
473
  // Enable Progress Bar Print
470
474
  //===--------------------------------------------------------------------===//
471
475
  void EnableProgressBarPrintSetting::SetLocal(ClientContext &context, const Value &input) {
472
- ClientConfig::GetConfig(context).print_progress_bar = input.GetValue<bool>();
476
+ auto &config = ClientConfig::GetConfig(context);
477
+ ProgressBar::SystemOverrideCheck(config);
478
+ config.print_progress_bar = input.GetValue<bool>();
473
479
  }
474
480
 
475
481
  void EnableProgressBarPrintSetting::ResetLocal(ClientContext &context) {
476
- ClientConfig::GetConfig(context).print_progress_bar = ClientConfig().print_progress_bar;
482
+ auto &config = ClientConfig::GetConfig(context);
483
+ ProgressBar::SystemOverrideCheck(config);
484
+ config.print_progress_bar = ClientConfig().print_progress_bar;
477
485
  }
478
486
 
479
487
  Value EnableProgressBarPrintSetting::GetSetting(ClientContext &context) {
@@ -878,13 +886,17 @@ Value ProfilingModeSetting::GetSetting(ClientContext &context) {
878
886
  //===--------------------------------------------------------------------===//
879
887
 
880
888
  void ProgressBarTimeSetting::ResetLocal(ClientContext &context) {
881
- ClientConfig::GetConfig(context).wait_time = ClientConfig().wait_time;
882
- ClientConfig::GetConfig(context).enable_progress_bar = ClientConfig().enable_progress_bar;
889
+ auto &config = ClientConfig::GetConfig(context);
890
+ ProgressBar::SystemOverrideCheck(config);
891
+ config.wait_time = ClientConfig().wait_time;
892
+ config.enable_progress_bar = ClientConfig().enable_progress_bar;
883
893
  }
884
894
 
885
895
  void ProgressBarTimeSetting::SetLocal(ClientContext &context, const Value &input) {
886
- ClientConfig::GetConfig(context).wait_time = input.GetValue<int32_t>();
887
- ClientConfig::GetConfig(context).enable_progress_bar = true;
896
+ auto &config = ClientConfig::GetConfig(context);
897
+ ProgressBar::SystemOverrideCheck(config);
898
+ config.wait_time = input.GetValue<int32_t>();
899
+ config.enable_progress_bar = true;
888
900
  }
889
901
 
890
902
  Value ProgressBarTimeSetting::GetSetting(ClientContext &context) {
@@ -2,21 +2,18 @@
2
2
 
3
3
  #include "duckdb/execution/expression_executor.hpp"
4
4
  #include "duckdb/planner/expression.hpp"
5
- #include "duckdb/planner/expression_iterator.hpp"
6
5
  #include "duckdb/planner/expression/bound_between_expression.hpp"
6
+ #include "duckdb/planner/expression/bound_cast_expression.hpp"
7
7
  #include "duckdb/planner/expression/bound_columnref_expression.hpp"
8
8
  #include "duckdb/planner/expression/bound_comparison_expression.hpp"
9
9
  #include "duckdb/planner/expression/bound_conjunction_expression.hpp"
10
10
  #include "duckdb/planner/expression/bound_constant_expression.hpp"
11
11
  #include "duckdb/planner/expression/bound_function_expression.hpp"
12
- #include "duckdb/planner/operator/logical_empty_result.hpp"
13
- #include "duckdb/planner/operator/logical_filter.hpp"
12
+ #include "duckdb/planner/expression/bound_operator_expression.hpp"
14
13
  #include "duckdb/planner/table_filter.hpp"
15
14
  #include "duckdb/planner/filter/constant_filter.hpp"
16
15
  #include "duckdb/planner/filter/null_filter.hpp"
17
16
  #include "duckdb/optimizer/optimizer.hpp"
18
- #include "duckdb/common/operator/cast_operators.hpp"
19
- #include "duckdb/planner/filter/conjunction_filter.hpp"
20
17
 
21
18
  namespace duckdb {
22
19
 
@@ -8,6 +8,8 @@
8
8
  #include "duckdb/storage/data_table.hpp"
9
9
  #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
10
10
 
11
+ #include <cmath>
12
+
11
13
  namespace duckdb {
12
14
 
13
15
  static TableCatalogEntry *GetCatalogTableEntry(LogicalOperator *op) {
@@ -7,6 +7,7 @@
7
7
  #include "duckdb/planner/operator/list.hpp"
8
8
 
9
9
  #include <algorithm>
10
+ #include <cmath>
10
11
 
11
12
  namespace std {
12
13
 
@@ -156,9 +156,6 @@ Pipeline *MetaPipeline::CreateUnionPipeline(Pipeline &current, bool order_matter
156
156
  void MetaPipeline::CreateChildPipeline(Pipeline &current, PhysicalOperator *op, Pipeline *last_pipeline) {
157
157
  // rule 2: 'current' must be fully built (down to the source) before creating the child pipeline
158
158
  D_ASSERT(current.source);
159
- if (HasRecursiveCTE()) {
160
- throw NotImplementedException("Child pipelines are not supported in recursive CTEs yet");
161
- }
162
159
 
163
160
  // create the child pipeline (same batch index)
164
161
  pipelines.emplace_back(state.CreateChildPipeline(executor, current, op));
@@ -1,7 +1,9 @@
1
+ #include "duckdb/common/serializer/enum_serializer.hpp"
1
2
  #include "duckdb/common/string_util.hpp"
2
3
  #include "duckdb/common/to_string.hpp"
3
4
  #include "duckdb/parser/expression/case_expression.hpp"
4
5
  #include "duckdb/parser/expression/cast_expression.hpp"
6
+ #include "duckdb/parser/expression/constant_expression.hpp"
5
7
  #include "duckdb/parser/expression/function_expression.hpp"
6
8
 
7
9
  #include "duckdb/parser/expression/operator_expression.hpp"
@@ -310,6 +312,26 @@ unique_ptr<ParsedExpression> Transformer::TransformFuncCall(duckdb_libpgquery::P
310
312
  coalesce_op->children.push_back(std::move(children[0]));
311
313
  coalesce_op->children.push_back(std::move(children[1]));
312
314
  return std::move(coalesce_op);
315
+ } else if (lowercase_name == "list" && order_bys->orders.size() == 1) {
316
+ // list(expr ORDER BY expr <sense> <nulls>) => list_sort(list(expr), <sense>, <nulls>)
317
+ if (children.size() != 1) {
318
+ throw ParserException("Wrong number of arguments to LIST.");
319
+ }
320
+ auto arg_expr = children[0].get();
321
+ auto &order_by = order_bys->orders[0];
322
+ if (arg_expr->Equals(order_by.expression.get())) {
323
+ auto sense = make_unique<ConstantExpression>(EnumSerializer::EnumToString(order_by.type));
324
+ auto nulls = make_unique<ConstantExpression>(EnumSerializer::EnumToString(order_by.null_order));
325
+ order_bys = nullptr;
326
+ auto unordered = make_unique<FunctionExpression>(
327
+ catalog, schema, lowercase_name.c_str(), std::move(children), std::move(filter_expr),
328
+ std::move(order_bys), root->agg_distinct, false, root->export_state);
329
+ lowercase_name = "list_sort";
330
+ children.clear();
331
+ children.emplace_back(std::move(unordered));
332
+ children.emplace_back(std::move(sense));
333
+ children.emplace_back(std::move(nulls));
334
+ }
313
335
  }
314
336
 
315
337
  auto function = make_unique<FunctionExpression>(std::move(catalog), std::move(schema), lowercase_name.c_str(),
@@ -3,6 +3,7 @@
3
3
  #include "duckdb/planner/binder.hpp"
4
4
  #include "duckdb/planner/constraints/list.hpp"
5
5
  #include "duckdb/planner/expression/bound_constant_expression.hpp"
6
+ #include "duckdb/planner/expression/bound_function_expression.hpp"
6
7
  #include "duckdb/planner/expression_binder/check_binder.hpp"
7
8
  #include "duckdb/planner/expression_binder/constant_binder.hpp"
8
9
  #include "duckdb/planner/parsed_data/bound_create_table_info.hpp"
@@ -1,7 +1,6 @@
1
1
  #include "duckdb/common/bitpacking.hpp"
2
2
 
3
3
  #include "duckdb/common/limits.hpp"
4
- #include "duckdb/common/types/null_value.hpp"
5
4
  #include "duckdb/function/compression/compression.hpp"
6
5
  #include "duckdb/function/compression_function.hpp"
7
6
  #include "duckdb/main/config.hpp"
@@ -11,6 +10,7 @@
11
10
  #include "duckdb/storage/table/column_segment.hpp"
12
11
  #include "duckdb/common/operator/subtract.hpp"
13
12
  #include "duckdb/storage/compression/bitpacking.hpp"
13
+ #include "duckdb/storage/table/scan_state.hpp"
14
14
 
15
15
  #include <functional>
16
16
 
@@ -9,6 +9,7 @@
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"
12
+ #include "duckdb/storage/table/scan_state.hpp"
12
13
 
13
14
  namespace duckdb {
14
15
 
@@ -64,7 +65,7 @@ void UncompressedCompressState::CreateEmptySegment(idx_t row_start) {
64
65
  auto compressed_segment = ColumnSegment::CreateTransientSegment(db, type, row_start);
65
66
  if (type.InternalType() == PhysicalType::VARCHAR) {
66
67
  auto &state = (UncompressedStringSegmentState &)*compressed_segment->GetSegmentState();
67
- state.overflow_writer = make_unique<WriteOverflowStringsToDisk>(checkpointer.GetColumnData().block_manager);
68
+ state.overflow_writer = make_unique<WriteOverflowStringsToDisk>(checkpointer.GetColumnData().GetBlockManager());
68
69
  }
69
70
  current_segment = std::move(compressed_segment);
70
71
  current_segment->InitializeAppend(append_state);
@@ -1,10 +1,10 @@
1
1
  #include "duckdb/function/compression/compression.hpp"
2
- #include "duckdb/storage/buffer_manager.hpp"
3
2
  #include "duckdb/common/types/vector.hpp"
4
3
 
5
4
  #include "duckdb/storage/table/column_segment.hpp"
6
5
  #include "duckdb/function/compression_function.hpp"
7
6
  #include "duckdb/storage/segment/uncompressed.hpp"
7
+ #include "duckdb/storage/table/scan_state.hpp"
8
8
 
9
9
  namespace duckdb {
10
10
 
@@ -6,6 +6,7 @@
6
6
  #include "duckdb/storage/table/column_data_checkpointer.hpp"
7
7
  #include "duckdb/storage/buffer_manager.hpp"
8
8
  #include "duckdb/common/types/null_value.hpp"
9
+ #include "duckdb/storage/table/scan_state.hpp"
9
10
  #include <functional>
10
11
 
11
12
  namespace duckdb {
@@ -6,7 +6,7 @@
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"
9
- #include "duckdb/main/config.hpp"
9
+ #include "duckdb/storage/table/scan_state.hpp"
10
10
 
11
11
  namespace duckdb {
12
12
 
@@ -5,7 +5,6 @@
5
5
  #include "duckdb/common/exception.hpp"
6
6
  #include "duckdb/common/helper.hpp"
7
7
  #include "duckdb/common/vector_operations/vector_operations.hpp"
8
- #include "duckdb/common/sort/sort.hpp"
9
8
  #include "duckdb/execution/expression_executor.hpp"
10
9
  #include "duckdb/main/client_context.hpp"
11
10
  #include "duckdb/parser/constraints/list.hpp"
@@ -23,6 +22,8 @@
23
22
  #include "duckdb/main/attached_database.hpp"
24
23
  #include "duckdb/common/types/conflict_manager.hpp"
25
24
  #include "duckdb/common/types/constraint_conflict_info.hpp"
25
+ #include "duckdb/storage/table/append_state.hpp"
26
+ #include "duckdb/storage/table/scan_state.hpp"
26
27
 
27
28
  namespace duckdb {
28
29
 
@@ -728,8 +729,7 @@ void DataTable::ScanTableSegment(idx_t row_start, idx_t count, const std::functi
728
729
  CreateIndexScanState state;
729
730
 
730
731
  InitializeScanWithOffset(state, column_ids, row_start, row_start + count);
731
- auto row_start_aligned = state.table_state.row_group_state.row_group->start +
732
- state.table_state.row_group_state.vector_index * STANDARD_VECTOR_SIZE;
732
+ auto row_start_aligned = state.table_state.row_group->start + state.table_state.vector_index * STANDARD_VECTOR_SIZE;
733
733
 
734
734
  idx_t current_row = row_start_aligned;
735
735
  while (current_row < end) {
@@ -11,6 +11,7 @@
11
11
  #include "duckdb/storage/table/column_checkpoint_state.hpp"
12
12
  #include "duckdb/storage/table/column_segment.hpp"
13
13
  #include "duckdb/storage/table_io_manager.hpp"
14
+ #include "duckdb/storage/table/scan_state.hpp"
14
15
 
15
16
  namespace duckdb {
16
17
 
@@ -355,6 +356,12 @@ LocalStorage::LocalStorage(ClientContext &context, DuckTransaction &transaction)
355
356
  : context(context), transaction(transaction) {
356
357
  }
357
358
 
359
+ LocalStorage::CommitState::CommitState() {
360
+ }
361
+
362
+ LocalStorage::CommitState::~CommitState() {
363
+ }
364
+
358
365
  LocalStorage &LocalStorage::Get(DuckTransaction &transaction) {
359
366
  return transaction.GetLocalStorage();
360
367
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  namespace duckdb {
4
4
 
5
- const uint64_t VERSION_NUMBER = 48;
5
+ const uint64_t VERSION_NUMBER = 49;
6
6
 
7
7
  struct StorageVersionInfo {
8
8
  const char *version_name;