duckdb 0.5.2-dev291.0 → 0.5.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.5.2-dev291.0",
4
+ "version": "0.5.2-dev314.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -34655,7 +34655,8 @@ void Deserializer::ReadStringVector(vector<string> &list) {
34655
34655
 
34656
34656
  namespace duckdb {
34657
34657
 
34658
- bool Comparators::TieIsBreakable(const idx_t &col_idx, const data_ptr_t row_ptr, const RowLayout &row_layout) {
34658
+ bool Comparators::TieIsBreakable(const idx_t &tie_col, const data_ptr_t &row_ptr, const SortLayout &sort_layout) {
34659
+ const auto &col_idx = sort_layout.sorting_to_blob_col.at(tie_col);
34659
34660
  // Check if the blob is NULL
34660
34661
  ValidityBytes row_mask(row_ptr);
34661
34662
  idx_t entry_idx;
@@ -34665,13 +34666,16 @@ bool Comparators::TieIsBreakable(const idx_t &col_idx, const data_ptr_t row_ptr,
34665
34666
  // Can't break a NULL tie
34666
34667
  return false;
34667
34668
  }
34668
- if (row_layout.GetTypes()[col_idx].InternalType() == PhysicalType::VARCHAR) {
34669
- const auto &tie_col_offset = row_layout.GetOffsets()[col_idx];
34670
- string_t tie_string = Load<string_t>(row_ptr + tie_col_offset);
34671
- if (tie_string.GetSize() < string_t::INLINE_LENGTH) {
34672
- // No need to break the tie - we already compared the full string
34673
- return false;
34674
- }
34669
+ auto &row_layout = sort_layout.blob_layout;
34670
+ if (row_layout.GetTypes()[col_idx].InternalType() != PhysicalType::VARCHAR) {
34671
+ // Nested type, must be broken
34672
+ return true;
34673
+ }
34674
+ const auto &tie_col_offset = row_layout.GetOffsets()[col_idx];
34675
+ auto tie_string = Load<string_t>(row_ptr + tie_col_offset);
34676
+ if (tie_string.GetSize() < sort_layout.prefix_lengths[tie_col]) {
34677
+ // No need to break the tie - we already compared the full string
34678
+ return false;
34675
34679
  }
34676
34680
  return true;
34677
34681
  }
@@ -34713,14 +34717,14 @@ int Comparators::CompareVal(const data_ptr_t l_ptr, const data_ptr_t r_ptr, cons
34713
34717
 
34714
34718
  int Comparators::BreakBlobTie(const idx_t &tie_col, const SBScanState &left, const SBScanState &right,
34715
34719
  const SortLayout &sort_layout, const bool &external) {
34716
- const idx_t &col_idx = sort_layout.sorting_to_blob_col.at(tie_col);
34717
34720
  data_ptr_t l_data_ptr = left.DataPtr(*left.sb->blob_sorting_data);
34718
34721
  data_ptr_t r_data_ptr = right.DataPtr(*right.sb->blob_sorting_data);
34719
- if (!TieIsBreakable(col_idx, l_data_ptr, sort_layout.blob_layout)) {
34722
+ if (!TieIsBreakable(tie_col, l_data_ptr, sort_layout)) {
34720
34723
  // Quick check to see if ties can be broken
34721
34724
  return 0;
34722
34725
  }
34723
34726
  // Align the pointers
34727
+ const idx_t &col_idx = sort_layout.sorting_to_blob_col.at(tie_col);
34724
34728
  const auto &tie_col_offset = sort_layout.blob_layout.GetOffsets()[col_idx];
34725
34729
  l_data_ptr += tie_col_offset;
34726
34730
  r_data_ptr += tie_col_offset;
@@ -36381,11 +36385,10 @@ namespace duckdb {
36381
36385
  static void SortTiedBlobs(BufferManager &buffer_manager, const data_ptr_t dataptr, const idx_t &start, const idx_t &end,
36382
36386
  const idx_t &tie_col, bool *ties, const data_ptr_t blob_ptr, const SortLayout &sort_layout) {
36383
36387
  const auto row_width = sort_layout.blob_layout.GetRowWidth();
36384
- const idx_t &col_idx = sort_layout.sorting_to_blob_col.at(tie_col);
36385
36388
  // Locate the first blob row in question
36386
36389
  data_ptr_t row_ptr = dataptr + start * sort_layout.entry_size;
36387
36390
  data_ptr_t blob_row_ptr = blob_ptr + Load<uint32_t>(row_ptr + sort_layout.comparison_size) * row_width;
36388
- if (!Comparators::TieIsBreakable(col_idx, blob_row_ptr, sort_layout.blob_layout)) {
36391
+ if (!Comparators::TieIsBreakable(tie_col, blob_row_ptr, sort_layout)) {
36389
36392
  // Quick check to see if ties can be broken
36390
36393
  return;
36391
36394
  }
@@ -36398,6 +36401,7 @@ static void SortTiedBlobs(BufferManager &buffer_manager, const data_ptr_t datapt
36398
36401
  }
36399
36402
  // Slow pointer-based sorting
36400
36403
  const int order = sort_layout.order_types[tie_col] == OrderType::DESCENDING ? -1 : 1;
36404
+ const idx_t &col_idx = sort_layout.sorting_to_blob_col.at(tie_col);
36401
36405
  const auto &tie_col_offset = sort_layout.blob_layout.GetOffsets()[col_idx];
36402
36406
  auto logical_type = sort_layout.blob_layout.GetTypes()[col_idx];
36403
36407
  std::sort(entry_ptrs, entry_ptrs + end - start,
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 "e682812c7"
15
- #define DUCKDB_VERSION "v0.5.2-dev291"
14
+ #define DUCKDB_SOURCE_ID "18dbc32f8"
15
+ #define DUCKDB_VERSION "v0.5.2-dev314"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -19132,7 +19132,7 @@ using ValidityBytes = RowLayout::ValidityBytes;
19132
19132
  struct Comparators {
19133
19133
  public:
19134
19134
  //! Whether a tie between two blobs can be broken
19135
- static bool TieIsBreakable(const idx_t &col_idx, const data_ptr_t row_ptr, const RowLayout &row_layout);
19135
+ static bool TieIsBreakable(const idx_t &col_idx, const data_ptr_t &row_ptr, const SortLayout &sort_layout);
19136
19136
  //! Compares the tuples that a being read from in the 'left' and 'right blocks during merge sort
19137
19137
  //! (only in case we cannot simply 'memcmp' - if there are blob columns)
19138
19138
  static int CompareTuple(const SBScanState &left, const SBScanState &right, const data_ptr_t &l_ptr,