duckdb 0.5.2-dev456.0 → 0.5.2-dev466.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-dev456.0",
4
+ "version": "0.5.2-dev466.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -34111,7 +34111,7 @@ static void HeapScatterListVector(Vector &v, idx_t vcount, const SelectionVector
34111
34111
 
34112
34112
  // serialize list validity
34113
34113
  for (idx_t entry_idx = 0; entry_idx < next; entry_idx++) {
34114
- auto list_idx = list_vdata.sel->get_index(entry_idx) + entry_offset;
34114
+ auto list_idx = list_vdata.sel->get_index(entry_idx + entry_offset);
34115
34115
  if (!list_vdata.validity.RowIsValid(list_idx)) {
34116
34116
  *(list_validitymask_location) &= ~(1UL << entry_offset_in_byte);
34117
34117
  }
@@ -200278,8 +200278,9 @@ void DataTable::ScanTableSegment(idx_t row_start, idx_t count, const std::functi
200278
200278
 
200279
200279
  CreateIndexScanState state;
200280
200280
 
200281
- idx_t row_start_aligned = row_start / STANDARD_VECTOR_SIZE * STANDARD_VECTOR_SIZE;
200282
- InitializeScanWithOffset(state, column_ids, row_start_aligned, row_start + count);
200281
+ InitializeScanWithOffset(state, column_ids, row_start, row_start + count);
200282
+ auto row_start_aligned = state.table_state.row_group_state.row_group->start +
200283
+ state.table_state.row_group_state.vector_index * STANDARD_VECTOR_SIZE;
200283
200284
 
200284
200285
  idx_t current_row = row_start_aligned;
200285
200286
  while (current_row < end) {
@@ -201016,6 +201017,9 @@ bool LocalStorage::ScanTableStorage(DataTable &table, LocalTableStorage &storage
201016
201017
  }
201017
201018
 
201018
201019
  void LocalStorage::Flush(DataTable &table, LocalTableStorage &storage) {
201020
+ // bulk append threshold: a full row group
201021
+ static constexpr const idx_t MERGE_THRESHOLD = RowGroup::ROW_GROUP_SIZE;
201022
+
201019
201023
  auto storage_entry = move(table_storage[&table]);
201020
201024
  table_storage[&table].reset();
201021
201025
 
@@ -201026,8 +201030,10 @@ void LocalStorage::Flush(DataTable &table, LocalTableStorage &storage) {
201026
201030
 
201027
201031
  TableAppendState append_state;
201028
201032
  table.AppendLock(append_state);
201029
- if (append_state.row_start == 0 && storage.table.info->indexes.Empty() && storage.deleted_rows == 0) {
201030
- // table is currently empty: move over the storage directly
201033
+ if ((append_state.row_start == 0 || storage.row_groups->GetTotalRows() >= MERGE_THRESHOLD) &&
201034
+ storage.table.info->indexes.Empty() && storage.deleted_rows == 0) {
201035
+ // table is currently empty OR we are bulk appending to a table with existing storage: move over the storage
201036
+ // directly
201031
201037
  table.MergeStorage(*storage.row_groups, storage.indexes, storage.stats);
201032
201038
  } else {
201033
201039
  bool constraint_violated = false;
@@ -205068,6 +205074,9 @@ void ListColumnData::Skip(ColumnScanState &state, idx_t count) {
205068
205074
  auto &first_entry = data[0];
205069
205075
  auto &last_entry = data[scan_count - 1];
205070
205076
  idx_t child_scan_count = last_entry.offset + last_entry.length - first_entry.offset;
205077
+ if (child_scan_count == 0) {
205078
+ return;
205079
+ }
205071
205080
 
205072
205081
  // skip the child state forward by the child_scan_count
205073
205082
  child_column->Skip(state.child_states[1], child_scan_count);
@@ -206517,7 +206526,7 @@ void RowGroupCollection::RevertAppendInternal(idx_t start_row, idx_t count) {
206517
206526
 
206518
206527
  void RowGroupCollection::MergeStorage(RowGroupCollection &data) {
206519
206528
  D_ASSERT(data.types == types);
206520
- auto index = row_start;
206529
+ auto index = row_start + total_rows.load();
206521
206530
  for (auto segment = data.row_groups->GetRootSegment(); segment; segment = segment->next.get()) {
206522
206531
  auto &row_group = (RowGroup &)*segment;
206523
206532
  auto new_group = make_unique<RowGroup>(row_group, index);
@@ -206568,15 +206577,16 @@ void RowGroupCollection::Update(TransactionData transaction, row_t *ids, const v
206568
206577
  auto row_group = (RowGroup *)row_groups->GetSegment(ids[pos]);
206569
206578
  row_t base_id =
206570
206579
  row_group->start + ((ids[pos] - row_group->start) / STANDARD_VECTOR_SIZE * STANDARD_VECTOR_SIZE);
206580
+ row_t max_id = MinValue<row_t>(base_id + STANDARD_VECTOR_SIZE, row_group->start + row_group->count);
206571
206581
  for (pos++; pos < updates.size(); pos++) {
206572
206582
  D_ASSERT(ids[pos] >= 0);
206573
- // check if this id still belongs to this vector
206583
+ // check if this id still belongs to this vector in this row group
206574
206584
  if (ids[pos] < base_id) {
206575
206585
  // id is before vector start -> it does not
206576
206586
  break;
206577
206587
  }
206578
- if (ids[pos] >= base_id + STANDARD_VECTOR_SIZE) {
206579
- // id is after vector end -> it does not
206588
+ if (ids[pos] >= max_id) {
206589
+ // id is after the maximum id in this vector -> it does not
206580
206590
  break;
206581
206591
  }
206582
206592
  }
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 "2198368ee"
15
- #define DUCKDB_VERSION "v0.5.2-dev456"
14
+ #define DUCKDB_SOURCE_ID "84b2449fa"
15
+ #define DUCKDB_VERSION "v0.5.2-dev466"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //