duckdb 0.5.2-dev733.0 → 0.5.2-dev737.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-dev733.0",
4
+ "version": "0.5.2-dev737.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -33349,7 +33349,7 @@ void RowOperations::SwizzleColumns(const RowLayout &layout, const data_ptr_t bas
33349
33349
  }
33350
33350
  data_ptr_t col_ptr = row_ptr + layout.GetOffsets()[col_idx];
33351
33351
  if (physical_type == PhysicalType::VARCHAR) {
33352
- data_ptr_t string_ptr = col_ptr + sizeof(uint32_t) + string_t::PREFIX_LENGTH;
33352
+ data_ptr_t string_ptr = col_ptr + string_t::HEADER_SIZE;
33353
33353
  for (idx_t i = 0; i < next; i++) {
33354
33354
  if (Load<uint32_t>(col_ptr) > string_t::INLINE_LENGTH) {
33355
33355
  // Overwrite the string pointer with the within-row offset (if not inlined)
@@ -33453,7 +33453,7 @@ void RowOperations::UnswizzlePointers(const RowLayout &layout, const data_ptr_t
33453
33453
  }
33454
33454
  data_ptr_t col_ptr = row_ptr + layout.GetOffsets()[col_idx];
33455
33455
  if (physical_type == PhysicalType::VARCHAR) {
33456
- data_ptr_t string_ptr = col_ptr + sizeof(uint32_t) + string_t::PREFIX_LENGTH;
33456
+ data_ptr_t string_ptr = col_ptr + string_t::HEADER_SIZE;
33457
33457
  for (idx_t i = 0; i < next; i++) {
33458
33458
  if (Load<uint32_t>(col_ptr) > string_t::INLINE_LENGTH) {
33459
33459
  // Overwrite the string offset with the pointer (if not inlined)
@@ -33610,7 +33610,7 @@ static void GatherVarchar(Vector &rows, const SelectionVector &row_sel, Vector &
33610
33610
  // Not inline, so unswizzle the copied pointer the pointer
33611
33611
  auto heap_ptr_ptr = row + heap_offset;
33612
33612
  auto heap_row_ptr = base_heap_ptr + Load<idx_t>(heap_ptr_ptr);
33613
- auto string_ptr = data_ptr_t(data + col_idx) + sizeof(uint32_t) + string_t::PREFIX_LENGTH;
33613
+ auto string_ptr = data_ptr_t(data + col_idx) + string_t::HEADER_SIZE;
33614
33614
  Store<data_ptr_t>(heap_row_ptr + Load<idx_t>(string_ptr), string_ptr);
33615
33615
  #ifdef DEBUG
33616
33616
  data[col_idx].Verify();
@@ -35779,14 +35779,14 @@ int Comparators::TemplatedCompareListLoop(data_ptr_t &left_ptr, data_ptr_t &righ
35779
35779
 
35780
35780
  void Comparators::UnswizzleSingleValue(data_ptr_t data_ptr, const data_ptr_t &heap_ptr, const LogicalType &type) {
35781
35781
  if (type.InternalType() == PhysicalType::VARCHAR) {
35782
- data_ptr += sizeof(uint32_t) + string_t::PREFIX_LENGTH;
35782
+ data_ptr += string_t::HEADER_SIZE;
35783
35783
  }
35784
35784
  Store<data_ptr_t>(heap_ptr + Load<idx_t>(data_ptr), data_ptr);
35785
35785
  }
35786
35786
 
35787
35787
  void Comparators::SwizzleSingleValue(data_ptr_t data_ptr, const data_ptr_t &heap_ptr, const LogicalType &type) {
35788
35788
  if (type.InternalType() == PhysicalType::VARCHAR) {
35789
- data_ptr += sizeof(uint32_t) + string_t::PREFIX_LENGTH;
35789
+ data_ptr += string_t::HEADER_SIZE;
35790
35790
  }
35791
35791
  Store<idx_t>(Load<data_ptr_t>(data_ptr) - heap_ptr, data_ptr);
35792
35792
  }
@@ -88518,6 +88518,9 @@ template <bool LAST, bool SKIP_NULLS>
88518
88518
  struct FirstFunctionString : public FirstFunctionBase {
88519
88519
  template <class STATE>
88520
88520
  static void SetValue(STATE *state, string_t value, bool is_null) {
88521
+ if (LAST && state->is_set) {
88522
+ Destroy(state);
88523
+ }
88521
88524
  if (is_null) {
88522
88525
  if (!SKIP_NULLS) {
88523
88526
  state->is_set = true;
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 "37960df94"
15
- #define DUCKDB_VERSION "v0.5.2-dev733"
14
+ #define DUCKDB_SOURCE_ID "9913e0e80"
15
+ #define DUCKDB_VERSION "v0.5.2-dev737"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -3681,8 +3681,16 @@ struct string_t {
3681
3681
  friend class StringSegment;
3682
3682
 
3683
3683
  public:
3684
- static constexpr idx_t PREFIX_LENGTH = 4 * sizeof(char);
3685
- static constexpr idx_t INLINE_LENGTH = 12;
3684
+ static constexpr idx_t PREFIX_BYTES = 4 * sizeof(char);
3685
+ static constexpr idx_t INLINE_BYTES = 12 * sizeof(char);
3686
+ static constexpr idx_t HEADER_SIZE = sizeof(uint32_t) + PREFIX_BYTES;
3687
+ #ifndef DUCKDB_DEBUG_NO_INLINE
3688
+ static constexpr idx_t PREFIX_LENGTH = PREFIX_BYTES;
3689
+ static constexpr idx_t INLINE_LENGTH = INLINE_BYTES;
3690
+ #else
3691
+ static constexpr idx_t PREFIX_LENGTH = 0;
3692
+ static constexpr idx_t INLINE_LENGTH = 0;
3693
+ #endif
3686
3694
 
3687
3695
  string_t() = default;
3688
3696
  explicit string_t(uint32_t len) {
@@ -3694,7 +3702,7 @@ public:
3694
3702
  if (IsInlined()) {
3695
3703
  // zero initialize the prefix first
3696
3704
  // this makes sure that strings with length smaller than 4 still have an equal prefix
3697
- memset(value.inlined.inlined, 0, INLINE_LENGTH);
3705
+ memset(value.inlined.inlined, 0, INLINE_BYTES);
3698
3706
  if (GetSize() == 0) {
3699
3707
  return;
3700
3708
  }
@@ -3702,7 +3710,11 @@ public:
3702
3710
  memcpy(value.inlined.inlined, data, GetSize());
3703
3711
  } else {
3704
3712
  // large string: store pointer
3713
+ #ifndef DUCKDB_DEBUG_NO_INLINE
3705
3714
  memcpy(value.pointer.prefix, data, PREFIX_LENGTH);
3715
+ #else
3716
+ memset(value.pointer.prefix, 0, PREFIX_BYTES);
3717
+ #endif
3706
3718
  value.pointer.ptr = (char *)data;
3707
3719
  }
3708
3720
  }
@@ -3743,15 +3755,19 @@ public:
3743
3755
 
3744
3756
  void Finalize() {
3745
3757
  // set trailing NULL byte
3746
- auto dataptr = (char *)GetDataUnsafe();
3747
3758
  if (GetSize() <= INLINE_LENGTH) {
3748
3759
  // fill prefix with zeros if the length is smaller than the prefix length
3749
- for (idx_t i = GetSize(); i < INLINE_LENGTH; i++) {
3760
+ for (idx_t i = GetSize(); i < INLINE_BYTES; i++) {
3750
3761
  value.inlined.inlined[i] = '\0';
3751
3762
  }
3752
3763
  } else {
3753
3764
  // copy the data into the prefix
3765
+ #ifndef DUCKDB_DEBUG_NO_INLINE
3766
+ auto dataptr = (char *)GetDataUnsafe();
3754
3767
  memcpy(value.pointer.prefix, dataptr, PREFIX_LENGTH);
3768
+ #else
3769
+ memset(value.pointer.prefix, 0, PREFIX_BYTES);
3770
+ #endif
3755
3771
  }
3756
3772
  }
3757
3773
 
@@ -7865,7 +7881,7 @@ struct StringComparisonOperators {
7865
7881
  }
7866
7882
  } else {
7867
7883
  // large string: first check prefix and length
7868
- if (memcmp(&a, &b, sizeof(uint32_t) + string_t::PREFIX_LENGTH) == 0) {
7884
+ if (memcmp(&a, &b, string_t::HEADER_SIZE) == 0) {
7869
7885
  // prefix and length are equal: check main string
7870
7886
  if (memcmp(a.value.pointer.ptr, b.value.pointer.ptr, a.GetSize()) == 0) {
7871
7887
  // entire string is equal