duckdb 0.6.2-dev1672.0 → 0.6.2-dev1678.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-dev1672.0",
5
+ "version": "0.6.2-dev1678.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.6.2-dev1672"
2
+ #define DUCKDB_VERSION "0.6.2-dev1678"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "b793c7459a"
5
+ #define DUCKDB_SOURCE_ID "2fd5ead296"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"
@@ -32,7 +32,7 @@ public:
32
32
  result->extension_name = extension_name;
33
33
  result->name = name;
34
34
  result->path = path;
35
- return move(result);
35
+ return unique_ptr<CreateInfo>(result.release());
36
36
  }
37
37
 
38
38
  static unique_ptr<CreateDatabaseInfo> Deserialize(Deserializer &deserializer) {
@@ -165,7 +165,7 @@ unique_ptr<LogicalOperator> Binder::BindUpdateSet(LogicalOperator *op, unique_pt
165
165
  }
166
166
  }
167
167
  if (op->type != LogicalOperatorType::LOGICAL_UPDATE && projection_expressions.empty()) {
168
- return move(root);
168
+ return root;
169
169
  }
170
170
  // now create the projection
171
171
  auto proj = make_unique<LogicalProjection>(proj_index, std::move(projection_expressions));
@@ -212,17 +212,11 @@ public:
212
212
  }
213
213
  }
214
214
 
215
- void CreateEmptySegment(idx_t row_start) {
216
- auto &db = checkpointer.GetDatabase();
217
- auto &type = checkpointer.GetType();
218
- auto compressed_segment = ColumnSegment::CreateTransientSegment(db, type, row_start);
219
- current_segment = std::move(compressed_segment);
220
-
221
- current_segment->function = function;
222
-
223
- // Reset the buffers and string map
215
+ void Reset() {
224
216
  index_buffer.clear();
225
217
  current_width = 0;
218
+ max_compressed_string_length = 0;
219
+ last_fitting_size = 0;
226
220
 
227
221
  // Reset the pointers into the current segment
228
222
  auto &buffer_manager = BufferManager::GetBufferManager(current_segment->db);
@@ -231,6 +225,15 @@ public:
231
225
  current_end_ptr = current_handle.Ptr() + current_dictionary.end;
232
226
  }
233
227
 
228
+ void CreateEmptySegment(idx_t row_start) {
229
+ auto &db = checkpointer.GetDatabase();
230
+ auto &type = checkpointer.GetType();
231
+ auto compressed_segment = ColumnSegment::CreateTransientSegment(db, type, row_start);
232
+ current_segment = std::move(compressed_segment);
233
+ current_segment->function = function;
234
+ Reset();
235
+ }
236
+
234
237
  void UpdateState(string_t uncompressed_string, unsigned char *compressed_string, size_t compressed_string_len) {
235
238
 
236
239
  if (!HasEnoughSpace(compressed_string_len)) {
@@ -284,10 +287,14 @@ public:
284
287
  BitpackingPrimitives::GetRequiredSize(current_string_count + 1, required_minimum_width);
285
288
 
286
289
  // TODO switch to a symbol table per RowGroup, saves a bit of space
287
- idx_t required_space = sizeof(fsst_compression_header_t) + current_dict_size + dict_offsets_size + string_len +
288
- fsst_serialized_symbol_table_size;
290
+ auto required_size = sizeof(fsst_compression_header_t) + current_dict_size + dict_offsets_size + string_len +
291
+ fsst_serialized_symbol_table_size;
289
292
 
290
- return required_space <= Storage::BLOCK_SIZE;
293
+ if (required_size <= Storage::BLOCK_SIZE) {
294
+ last_fitting_size = required_size;
295
+ return true;
296
+ }
297
+ return false;
291
298
  }
292
299
 
293
300
  void Flush(bool final = false) {
@@ -313,6 +320,10 @@ public:
313
320
  auto total_size = sizeof(fsst_compression_header_t) + compressed_index_buffer_size + current_dictionary.size +
314
321
  fsst_serialized_symbol_table_size;
315
322
 
323
+ if (total_size != last_fitting_size) {
324
+ throw InternalException("FSST string compression failed due to incorrect size calculation");
325
+ }
326
+
316
327
  // calculate ptr and offsets
317
328
  auto base_ptr = handle.Ptr();
318
329
  auto header_ptr = (fsst_compression_header_t *)base_ptr;
@@ -334,11 +345,6 @@ public:
334
345
  Store<uint32_t>(symbol_table_offset, (data_ptr_t)&header_ptr->fsst_symbol_table_offset);
335
346
  Store<uint32_t>((uint32_t)current_width, (data_ptr_t)&header_ptr->bitpacking_width);
336
347
 
337
- if (symbol_table_offset + fsst_serialized_symbol_table_size >
338
- current_dictionary.end - current_dictionary.size) {
339
- throw InternalException("FSST string compression failed due to incorrect size calculation");
340
- }
341
-
342
348
  if (total_size >= FSSTStorage::COMPACTION_FLUSH_LIMIT) {
343
349
  // the block is full enough, don't bother moving around the dictionary
344
350
  return Storage::BLOCK_SIZE;
@@ -369,8 +375,9 @@ public:
369
375
  // Buffers and map for current segment
370
376
  std::vector<uint32_t> index_buffer;
371
377
 
372
- size_t max_compressed_string_length = 0;
373
- bitpacking_width_t current_width = 0;
378
+ size_t max_compressed_string_length;
379
+ bitpacking_width_t current_width;
380
+ idx_t last_fitting_size;
374
381
 
375
382
  duckdb_fsst_encoder_t *fsst_encoder = nullptr;
376
383
  unsigned char fsst_serialized_symbol_table[sizeof(duckdb_fsst_decoder_t)];