duckdb 0.8.2-dev1764.0 → 0.8.2-dev1859.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 (63) hide show
  1. package/README.md +7 -0
  2. package/binding.gyp +1 -0
  3. package/package.json +1 -1
  4. package/src/duckdb/extension/parquet/include/parquet_reader.hpp +1 -0
  5. package/src/duckdb/extension/parquet/parquet_extension.cpp +38 -22
  6. package/src/duckdb/extension/parquet/parquet_reader.cpp +1 -4
  7. package/src/duckdb/src/common/constants.cpp +2 -1
  8. package/src/duckdb/src/common/enum_util.cpp +5 -5
  9. package/src/duckdb/src/common/sort/sort_state.cpp +1 -1
  10. package/src/duckdb/src/common/sort/sorted_block.cpp +1 -1
  11. package/src/duckdb/src/common/types/column/column_data_collection.cpp +8 -0
  12. package/src/duckdb/src/common/types/column/column_data_collection_segment.cpp +5 -0
  13. package/src/duckdb/src/common/types/string_heap.cpp +4 -0
  14. package/src/duckdb/src/core_functions/function_list.cpp +2 -0
  15. package/src/duckdb/src/core_functions/scalar/debug/vector_type.cpp +23 -0
  16. package/src/duckdb/src/execution/index/art/art.cpp +49 -108
  17. package/src/duckdb/src/execution/index/art/art_key.cpp +0 -11
  18. package/src/duckdb/src/execution/index/art/fixed_size_allocator.cpp +10 -14
  19. package/src/duckdb/src/execution/index/art/iterator.cpp +13 -19
  20. package/src/duckdb/src/execution/index/art/leaf.cpp +290 -241
  21. package/src/duckdb/src/execution/index/art/node.cpp +104 -95
  22. package/src/duckdb/src/execution/index/art/node16.cpp +6 -6
  23. package/src/duckdb/src/execution/index/art/node256.cpp +6 -6
  24. package/src/duckdb/src/execution/index/art/node4.cpp +6 -6
  25. package/src/duckdb/src/execution/index/art/node48.cpp +6 -6
  26. package/src/duckdb/src/execution/index/art/prefix.cpp +49 -39
  27. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +34 -1175
  28. package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +4 -14
  29. package/src/duckdb/src/execution/window_executor.cpp +1280 -0
  30. package/src/duckdb/src/execution/window_segment_tree.cpp +224 -117
  31. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  32. package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
  33. package/src/duckdb/src/include/duckdb/common/type_util.hpp +8 -0
  34. package/src/duckdb/src/include/duckdb/common/typedefs.hpp +8 -0
  35. package/src/duckdb/src/include/duckdb/common/types/column/column_data_allocator.hpp +10 -0
  36. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +3 -0
  37. package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_segment.hpp +2 -0
  38. package/src/duckdb/src/include/duckdb/common/types/string_heap.hpp +3 -0
  39. package/src/duckdb/src/include/duckdb/core_functions/scalar/debug_functions.hpp +27 -0
  40. package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +1 -1
  41. package/src/duckdb/src/include/duckdb/execution/index/art/art_key.hpp +0 -1
  42. package/src/duckdb/src/include/duckdb/execution/index/art/fixed_size_allocator.hpp +22 -24
  43. package/src/duckdb/src/include/duckdb/execution/index/art/iterator.hpp +2 -2
  44. package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +43 -40
  45. package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +119 -40
  46. package/src/duckdb/src/include/duckdb/execution/index/art/node16.hpp +1 -0
  47. package/src/duckdb/src/include/duckdb/execution/index/art/node256.hpp +1 -0
  48. package/src/duckdb/src/include/duckdb/execution/index/art/node4.hpp +1 -0
  49. package/src/duckdb/src/include/duckdb/execution/index/art/node48.hpp +1 -0
  50. package/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +4 -2
  51. package/src/duckdb/src/include/duckdb/execution/window_executor.hpp +313 -0
  52. package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +60 -53
  53. package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +1 -0
  54. package/src/duckdb/src/parser/parser.cpp +43 -38
  55. package/src/duckdb/src/storage/arena_allocator.cpp +12 -0
  56. package/src/duckdb/src/storage/compression/rle.cpp +52 -12
  57. package/src/duckdb/ub_src_core_functions_scalar_debug.cpp +2 -0
  58. package/src/duckdb/ub_src_execution.cpp +2 -0
  59. package/src/duckdb/ub_src_execution_index_art.cpp +0 -4
  60. package/src/duckdb/src/execution/index/art/leaf_segment.cpp +0 -52
  61. package/src/duckdb/src/execution/index/art/swizzleable_pointer.cpp +0 -22
  62. package/src/duckdb/src/include/duckdb/execution/index/art/leaf_segment.hpp +0 -38
  63. package/src/duckdb/src/include/duckdb/execution/index/art/swizzleable_pointer.hpp +0 -58
@@ -1,9 +1,5 @@
1
1
  #include "duckdb/execution/index/art/fixed_size_allocator.hpp"
2
2
 
3
- #include "duckdb/common/allocator.hpp"
4
- #include "duckdb/common/exception.hpp"
5
- #include "duckdb/common/helper.hpp"
6
-
7
3
  namespace duckdb {
8
4
 
9
5
  constexpr idx_t FixedSizeAllocator::BASE[];
@@ -46,7 +42,7 @@ FixedSizeAllocator::~FixedSizeAllocator() {
46
42
  }
47
43
  }
48
44
 
49
- SwizzleablePointer FixedSizeAllocator::New() {
45
+ Node FixedSizeAllocator::New() {
50
46
 
51
47
  // no more free pointers
52
48
  if (buffers_with_free_space.empty()) {
@@ -77,19 +73,19 @@ SwizzleablePointer FixedSizeAllocator::New() {
77
73
  buffers_with_free_space.erase(buffer_id);
78
74
  }
79
75
 
80
- return SwizzleablePointer(offset, buffer_id);
76
+ return Node(buffer_id, offset);
81
77
  }
82
78
 
83
- void FixedSizeAllocator::Free(const SwizzleablePointer ptr) {
84
- auto bitmask_ptr = reinterpret_cast<validity_t *>(buffers[ptr.buffer_id].ptr);
79
+ void FixedSizeAllocator::Free(const Node ptr) {
80
+ auto bitmask_ptr = reinterpret_cast<validity_t *>(buffers[ptr.GetBufferId()].ptr);
85
81
  ValidityMask mask(bitmask_ptr);
86
- D_ASSERT(!mask.RowIsValid(ptr.offset));
87
- mask.SetValid(ptr.offset);
88
- buffers_with_free_space.insert(ptr.buffer_id);
82
+ D_ASSERT(!mask.RowIsValid(ptr.GetOffset()));
83
+ mask.SetValid(ptr.GetOffset());
84
+ buffers_with_free_space.insert(ptr.GetBufferId());
89
85
 
90
86
  D_ASSERT(total_allocations > 0);
91
- D_ASSERT(buffers[ptr.buffer_id].allocation_count > 0);
92
- buffers[ptr.buffer_id].allocation_count--;
87
+ D_ASSERT(buffers[ptr.GetBufferId()].allocation_count > 0);
88
+ buffers[ptr.GetBufferId()].allocation_count--;
93
89
  total_allocations--;
94
90
  }
95
91
 
@@ -172,7 +168,7 @@ void FixedSizeAllocator::FinalizeVacuum() {
172
168
  }
173
169
  }
174
170
 
175
- SwizzleablePointer FixedSizeAllocator::VacuumPointer(const SwizzleablePointer ptr) {
171
+ Node FixedSizeAllocator::VacuumPointer(const Node ptr) {
176
172
 
177
173
  // we do not need to adjust the bitmask of the old buffer, because we will free the entire
178
174
  // buffer after the vacuum operation
@@ -58,17 +58,11 @@ bool Iterator::Scan(const ARTKey &upper_bound, const idx_t max_count, vector<row
58
58
  }
59
59
  }
60
60
 
61
- // adding more elements would exceed the maximum count
62
- if (result_ids.size() + last_leaf->count > max_count) {
61
+ // copy all row IDs of this leaf into the result IDs (if they don't exceed max_count)
62
+ if (!Leaf::GetRowIds(*art, last_leaf, result_ids, max_count)) {
63
63
  return false;
64
64
  }
65
65
 
66
- // FIXME: copy all at once to improve performance
67
- for (idx_t i = 0; i < last_leaf->count; i++) {
68
- row_t row_id = last_leaf->GetRowId(*art, i);
69
- result_ids.push_back(row_id);
70
- }
71
-
72
66
  // get the next leaf
73
67
  has_next = Next();
74
68
 
@@ -80,18 +74,18 @@ bool Iterator::Scan(const ARTKey &upper_bound, const idx_t max_count, vector<row
80
74
  void Iterator::FindMinimum(Node &node) {
81
75
 
82
76
  D_ASSERT(node.IsSet());
83
- if (node.IsSwizzled()) {
77
+ if (node.IsSerialized()) {
84
78
  node.Deserialize(*art);
85
79
  }
86
80
 
87
81
  // found the minimum
88
- if (node.DecodeARTNodeType() == NType::LEAF) {
89
- last_leaf = Node::GetAllocator(*art, NType::LEAF).Get<Leaf>(node);
82
+ if (node.GetType() == NType::LEAF || node.GetType() == NType::LEAF_INLINED) {
83
+ last_leaf = node;
90
84
  return;
91
85
  }
92
86
 
93
87
  // traverse the prefix
94
- if (node.DecodeARTNodeType() == NType::PREFIX) {
88
+ if (node.GetType() == NType::PREFIX) {
95
89
  auto &prefix = Prefix::Get(*art, node);
96
90
  for (idx_t i = 0; i < prefix.data[Node::PREFIX_SIZE]; i++) {
97
91
  current_key.Push(prefix.data[i]);
@@ -115,20 +109,20 @@ bool Iterator::LowerBound(Node &node, const ARTKey &key, const bool equal, idx_t
115
109
  return false;
116
110
  }
117
111
 
118
- if (node.IsSwizzled()) {
112
+ if (node.IsSerialized()) {
119
113
  node.Deserialize(*art);
120
114
  }
121
115
 
122
116
  // we found the lower bound
123
- if (node.DecodeARTNodeType() == NType::LEAF) {
117
+ if (node.GetType() == NType::LEAF || node.GetType() == NType::LEAF_INLINED) {
124
118
  if (!equal && current_key == key) {
125
119
  return Next();
126
120
  }
127
- last_leaf = Node::GetAllocator(*art, NType::LEAF).Get<Leaf>(node);
121
+ last_leaf = node;
128
122
  return true;
129
123
  }
130
124
 
131
- if (node.DecodeARTNodeType() != NType::PREFIX) {
125
+ if (node.GetType() != NType::PREFIX) {
132
126
  auto next_byte = key[depth];
133
127
  auto child = node.GetNextChild(*art, next_byte);
134
128
  if (!child) {
@@ -181,9 +175,9 @@ bool Iterator::Next() {
181
175
  while (!nodes.empty()) {
182
176
 
183
177
  auto &top = nodes.top();
184
- D_ASSERT(top.node.DecodeARTNodeType() != NType::LEAF);
178
+ D_ASSERT(top.node.GetType() != NType::LEAF && top.node.GetType() != NType::LEAF_INLINED);
185
179
 
186
- if (top.node.DecodeARTNodeType() == NType::PREFIX) {
180
+ if (top.node.GetType() == NType::PREFIX) {
187
181
  PopNode();
188
182
  continue;
189
183
  }
@@ -211,7 +205,7 @@ bool Iterator::Next() {
211
205
  }
212
206
 
213
207
  void Iterator::PopNode() {
214
- if (nodes.top().node.DecodeARTNodeType() == NType::PREFIX) {
208
+ if (nodes.top().node.GetType() == NType::PREFIX) {
215
209
  auto prefix_byte_count = Prefix::Get(*art, nodes.top().node).data[Node::PREFIX_SIZE];
216
210
  current_key.Pop(prefix_byte_count);
217
211
  } else {