duckdb 0.6.2-dev1752.0 → 0.6.2-dev1762.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
@@ -2,7 +2,7 @@
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
4
  "types": "./lib/duckdb.d.ts",
5
- "version": "0.6.2-dev1752.0",
5
+ "version": "0.6.2-dev1762.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -11,7 +11,7 @@
11
11
  namespace duckdb {
12
12
 
13
13
  template <class OP, class RETURN_TYPE, typename... ARGS>
14
- RETURN_TYPE RadixBitsSwitch(idx_t radix_bits, ARGS &&...args) {
14
+ RETURN_TYPE RadixBitsSwitch(idx_t radix_bits, ARGS &&... args) {
15
15
  D_ASSERT(radix_bits <= sizeof(hash_t) * 8);
16
16
  switch (radix_bits) {
17
17
  case 1:
@@ -40,7 +40,7 @@ RETURN_TYPE RadixBitsSwitch(idx_t radix_bits, ARGS &&...args) {
40
40
  }
41
41
 
42
42
  template <class OP, class RETURN_TYPE, idx_t radix_bits_1, typename... ARGS>
43
- RETURN_TYPE DoubleRadixBitsSwitch2(idx_t radix_bits_2, ARGS &&...args) {
43
+ RETURN_TYPE DoubleRadixBitsSwitch2(idx_t radix_bits_2, ARGS &&... args) {
44
44
  D_ASSERT(radix_bits_2 <= sizeof(hash_t) * 8);
45
45
  switch (radix_bits_2) {
46
46
  case 1:
@@ -69,7 +69,7 @@ RETURN_TYPE DoubleRadixBitsSwitch2(idx_t radix_bits_2, ARGS &&...args) {
69
69
  }
70
70
 
71
71
  template <class OP, class RETURN_TYPE, typename... ARGS>
72
- RETURN_TYPE DoubleRadixBitsSwitch1(idx_t radix_bits_1, idx_t radix_bits_2, ARGS &&...args) {
72
+ RETURN_TYPE DoubleRadixBitsSwitch1(idx_t radix_bits_1, idx_t radix_bits_2, ARGS &&... args) {
73
73
  D_ASSERT(radix_bits_1 <= sizeof(hash_t) * 8);
74
74
  switch (radix_bits_1) {
75
75
  case 1:
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.6.2-dev1752"
2
+ #define DUCKDB_VERSION "0.6.2-dev1762"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "82810801b4"
5
+ #define DUCKDB_SOURCE_ID "45fed7847f"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"
@@ -120,7 +120,7 @@ void DeleteArray(T *ptr, idx_t size) {
120
120
  }
121
121
 
122
122
  template <typename T, typename... ARGS>
123
- T *AllocateObject(ARGS &&...args) {
123
+ T *AllocateObject(ARGS &&... args) {
124
124
  auto data = Allocator::DefaultAllocator().AllocateData(sizeof(T));
125
125
  return new (data) T(std::forward<ARGS>(args)...);
126
126
  }
@@ -271,7 +271,7 @@ public:
271
271
  }
272
272
 
273
273
  template <class T, typename... ARGS>
274
- unique_ptr<T> ReadOptional(unique_ptr<T> default_value, ARGS &&...args) {
274
+ unique_ptr<T> ReadOptional(unique_ptr<T> default_value, ARGS &&... args) {
275
275
  if (field_count >= max_field_count) {
276
276
  // field is not there, read the default value
277
277
  return default_value;
@@ -293,7 +293,7 @@ public:
293
293
  }
294
294
 
295
295
  template <class T, class RETURN_TYPE = unique_ptr<T>, typename... ARGS>
296
- RETURN_TYPE ReadSerializable(RETURN_TYPE default_value, ARGS &&...args) {
296
+ RETURN_TYPE ReadSerializable(RETURN_TYPE default_value, ARGS &&... args) {
297
297
  if (field_count >= max_field_count) {
298
298
  // field is not there, read the default value
299
299
  return default_value;
@@ -315,7 +315,7 @@ public:
315
315
  }
316
316
 
317
317
  template <class T, class RETURN_TYPE = unique_ptr<T>, typename... ARGS>
318
- RETURN_TYPE ReadRequiredSerializable(ARGS &&...args) {
318
+ RETURN_TYPE ReadRequiredSerializable(ARGS &&... args) {
319
319
  if (field_count >= max_field_count) {
320
320
  // field is not there, throw an exception
321
321
  throw SerializationException("Attempting to read mandatory field, but field is missing");
@@ -326,7 +326,7 @@ public:
326
326
  }
327
327
 
328
328
  template <class T, class RETURN_TYPE = unique_ptr<T>, typename... ARGS>
329
- vector<RETURN_TYPE> ReadRequiredSerializableList(ARGS &&...args) {
329
+ vector<RETURN_TYPE> ReadRequiredSerializableList(ARGS &&... args) {
330
330
  if (field_count >= max_field_count) {
331
331
  // field is not there, throw an exception
332
332
  throw SerializationException("Attempting to read mandatory field, but field is missing");
@@ -119,7 +119,7 @@ public:
119
119
  }
120
120
 
121
121
  template <class T, typename... ARGS>
122
- void ReadList(vector<unique_ptr<T>> &list, ARGS &&...args) {
122
+ void ReadList(vector<unique_ptr<T>> &list, ARGS &&... args) {
123
123
  auto select_count = Read<uint32_t>();
124
124
  for (uint32_t i = 0; i < select_count; i++) {
125
125
  auto child = T::Deserialize(*this, std::forward<ARGS>(args)...);
@@ -128,7 +128,7 @@ public:
128
128
  }
129
129
 
130
130
  template <class T, class RETURN_TYPE = T, typename... ARGS>
131
- unique_ptr<RETURN_TYPE> ReadOptional(ARGS &&...args) {
131
+ unique_ptr<RETURN_TYPE> ReadOptional(ARGS &&... args) {
132
132
  auto has_entry = Read<bool>();
133
133
  if (has_entry) {
134
134
  return T::Deserialize(*this, std::forward<ARGS>(args)...);
@@ -235,10 +235,11 @@ public:
235
235
  }
236
236
 
237
237
  void UpdateState(string_t uncompressed_string, unsigned char *compressed_string, size_t compressed_string_len) {
238
-
239
238
  if (!HasEnoughSpace(compressed_string_len)) {
240
239
  Flush();
241
- D_ASSERT(HasEnoughSpace(compressed_string_len));
240
+ if (!HasEnoughSpace(compressed_string_len)) {
241
+ throw InternalException("FSST string compression failed due to insufficient space in empty block");
242
+ };
242
243
  }
243
244
 
244
245
  UncompressedStringStorage::UpdateStringStats(current_segment->stats, uncompressed_string);
@@ -261,7 +262,9 @@ public:
261
262
  void AddNull() {
262
263
  if (!HasEnoughSpace(0)) {
263
264
  Flush();
264
- D_ASSERT(HasEnoughSpace(0));
265
+ if (!HasEnoughSpace(0)) {
266
+ throw InternalException("FSST string compression failed due to insufficient space in empty block");
267
+ };
265
268
  }
266
269
  index_buffer.push_back(0);
267
270
  current_segment->count++;
@@ -272,7 +275,7 @@ public:
272
275
  UncompressedStringStorage::UpdateStringStats(current_segment->stats, "");
273
276
  }
274
277
 
275
- bool HasEnoughSpace(size_t string_len) {
278
+ size_t GetRequiredSize(size_t string_len) {
276
279
  bitpacking_width_t required_minimum_width;
277
280
  if (string_len > max_compressed_string_length) {
278
281
  required_minimum_width = BitpackingPrimitives::MinimumBitWidth(string_len);
@@ -287,8 +290,13 @@ public:
287
290
  BitpackingPrimitives::GetRequiredSize(current_string_count + 1, required_minimum_width);
288
291
 
289
292
  // TODO switch to a symbol table per RowGroup, saves a bit of space
290
- auto required_size = sizeof(fsst_compression_header_t) + current_dict_size + dict_offsets_size + string_len +
291
- fsst_serialized_symbol_table_size;
293
+ return sizeof(fsst_compression_header_t) + current_dict_size + dict_offsets_size + string_len +
294
+ fsst_serialized_symbol_table_size;
295
+ }
296
+
297
+ // Checks if there is enough space, if there is, sets last_fitting_size
298
+ bool HasEnoughSpace(size_t string_len) {
299
+ auto required_size = GetRequiredSize(string_len);
292
300
 
293
301
  if (required_size <= Storage::BLOCK_SIZE) {
294
302
  last_fitting_size = required_size;