duckdb 0.5.1-dev50.0 → 0.5.1-dev61.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.5.1-dev50.0",
4
+ "version": "0.5.1-dev61.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -35676,7 +35676,10 @@ struct SortConstants {
35676
35676
 
35677
35677
  struct SortLayout {
35678
35678
  public:
35679
+ SortLayout() {
35680
+ }
35679
35681
  explicit SortLayout(const vector<BoundOrderByNode> &orders);
35682
+ SortLayout GetPrefixComparisonLayout(idx_t num_prefix_cols) const;
35680
35683
 
35681
35684
  public:
35682
35685
  idx_t column_count;
@@ -37327,6 +37330,32 @@ SortLayout::SortLayout(const vector<BoundOrderByNode> &orders)
37327
37330
  blob_layout.Initialize(blob_layout_types);
37328
37331
  }
37329
37332
 
37333
+ SortLayout SortLayout::GetPrefixComparisonLayout(idx_t num_prefix_cols) const {
37334
+ SortLayout result;
37335
+ result.column_count = num_prefix_cols;
37336
+ result.all_constant = true;
37337
+ result.comparison_size = 0;
37338
+ for (idx_t col_idx = 0; col_idx < num_prefix_cols; col_idx++) {
37339
+ result.order_types.push_back(order_types[col_idx]);
37340
+ result.order_by_null_types.push_back(order_by_null_types[col_idx]);
37341
+ result.logical_types.push_back(logical_types[col_idx]);
37342
+
37343
+ result.all_constant = result.all_constant && constant_size[col_idx];
37344
+ result.constant_size.push_back(constant_size[col_idx]);
37345
+
37346
+ result.comparison_size += column_sizes[col_idx];
37347
+ result.column_sizes.push_back(column_sizes[col_idx]);
37348
+
37349
+ result.prefix_lengths.push_back(prefix_lengths[col_idx]);
37350
+ result.stats.push_back(stats[col_idx]);
37351
+ result.has_null.push_back(has_null[col_idx]);
37352
+ }
37353
+ result.entry_size = entry_size;
37354
+ result.blob_layout = blob_layout;
37355
+ result.sorting_to_blob_col = sorting_to_blob_col;
37356
+ return result;
37357
+ }
37358
+
37330
37359
  LocalSortState::LocalSortState() : initialized(false) {
37331
37360
  }
37332
37361
 
@@ -64930,12 +64959,14 @@ public:
64930
64959
 
64931
64960
  WindowGlobalHashGroup(BufferManager &buffer_manager, const Orders &partitions, const Orders &orders,
64932
64961
  const Types &payload_types, idx_t max_mem, bool external)
64933
- : memory_per_thread(max_mem), count(0), partition_layout(partitions) {
64962
+ : memory_per_thread(max_mem), count(0) {
64934
64963
 
64935
64964
  RowLayout payload_layout;
64936
64965
  payload_layout.Initialize(payload_types);
64937
64966
  global_sort = make_unique<GlobalSortState>(buffer_manager, orders, payload_layout);
64938
64967
  global_sort->external = external;
64968
+
64969
+ partition_layout = global_sort->sort_layout.GetPrefixComparisonLayout(partitions.size());
64939
64970
  }
64940
64971
 
64941
64972
  void Combine(LocalSortState &local_sort) {
@@ -104322,18 +104353,12 @@ void SinkDataChunk(Vector *child_vector, SelectionVector &sel, idx_t offset_list
104322
104353
  static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &result) {
104323
104354
  D_ASSERT(args.ColumnCount() >= 1 && args.ColumnCount() <= 3);
104324
104355
  auto count = args.size();
104325
- Vector &lists = args.data[0];
104356
+ Vector &input_lists = args.data[0];
104326
104357
 
104327
104358
  result.SetVectorType(VectorType::FLAT_VECTOR);
104328
104359
  auto &result_validity = FlatVector::Validity(result);
104329
104360
 
104330
- for (auto &v : args.data) {
104331
- if (v.GetVectorType() != VectorType::FLAT_VECTOR && v.GetVectorType() != VectorType::CONSTANT_VECTOR) {
104332
- v.Flatten(count);
104333
- }
104334
- }
104335
-
104336
- if (lists.GetType().id() == LogicalTypeId::SQLNULL) {
104361
+ if (input_lists.GetType().id() == LogicalTypeId::SQLNULL) {
104337
104362
  result_validity.SetInvalid(0);
104338
104363
  return;
104339
104364
  }
@@ -104348,15 +104373,18 @@ static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &re
104348
104373
  LocalSortState local_sort_state;
104349
104374
  local_sort_state.Initialize(global_sort_state, buffer_manager);
104350
104375
 
104376
+ // this ensures that we do not change the order of the entries in the input chunk
104377
+ VectorOperations::Copy(input_lists, result, count, 0, 0);
104378
+
104351
104379
  // get the child vector
104352
- auto lists_size = ListVector::GetListSize(lists);
104353
- auto &child_vector = ListVector::GetEntry(lists);
104380
+ auto lists_size = ListVector::GetListSize(result);
104381
+ auto &child_vector = ListVector::GetEntry(result);
104354
104382
  UnifiedVectorFormat child_data;
104355
104383
  child_vector.ToUnifiedFormat(lists_size, child_data);
104356
104384
 
104357
104385
  // get the lists data
104358
104386
  UnifiedVectorFormat lists_data;
104359
- lists.ToUnifiedFormat(count, lists_data);
104387
+ result.ToUnifiedFormat(count, lists_data);
104360
104388
  auto list_entries = (list_entry_t *)lists_data.data;
104361
104389
 
104362
104390
  // create the lists_indices vector, this contains an element for each list's entry,
@@ -104453,8 +104481,6 @@ static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &re
104453
104481
  child_vector.Flatten(sel_sorted_idx);
104454
104482
  }
104455
104483
 
104456
- result.Reference(lists);
104457
-
104458
104484
  if (args.AllConstant()) {
104459
104485
  result.SetVectorType(VectorType::CONSTANT_VECTOR);
104460
104486
  }
package/src/duckdb.hpp CHANGED
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
13
  #define DUCKDB_AMALGAMATION_EXTENDED 1
14
- #define DUCKDB_SOURCE_ID "70b2c7359"
15
- #define DUCKDB_VERSION "v0.5.1-dev50"
14
+ #define DUCKDB_SOURCE_ID "8a4d0609c"
15
+ #define DUCKDB_VERSION "v0.5.1-dev61"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //