duckdb 0.5.2-dev1455.0 → 0.5.2-dev1460.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.5.2-dev1455.0",
5
+ "version": "0.5.2-dev1460.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -75145,8 +75145,7 @@ namespace duckdb {
75145
75145
  class TableCatalogEntry;
75146
75146
 
75147
75147
  struct TableScanBindData : public TableFunctionData {
75148
- explicit TableScanBindData(TableCatalogEntry *table)
75149
- : table(table), is_index_scan(false), is_create_index(false), chunk_count(0) {
75148
+ explicit TableScanBindData(TableCatalogEntry *table) : table(table), is_index_scan(false), is_create_index(false) {
75150
75149
  }
75151
75150
 
75152
75151
  //! The table to scan
@@ -75159,9 +75158,6 @@ struct TableScanBindData : public TableFunctionData {
75159
75158
  //! The row ids to fetch (in case of an index scan)
75160
75159
  vector<row_t> result_ids;
75161
75160
 
75162
- //! How many chunks we already scanned
75163
- atomic<idx_t> chunk_count;
75164
-
75165
75161
  public:
75166
75162
  bool Equals(const FunctionData &other_p) const override {
75167
75163
  auto &other = (const TableScanBindData &)other_p;
@@ -128157,7 +128153,7 @@ static storage_t GetStorageIndex(TableCatalogEntry &table, column_t column_id) {
128157
128153
  }
128158
128154
 
128159
128155
  struct TableScanGlobalState : public GlobalTableFunctionState {
128160
- TableScanGlobalState(ClientContext &context, const FunctionData *bind_data_p) {
128156
+ TableScanGlobalState(ClientContext &context, const FunctionData *bind_data_p) : row_count(0) {
128161
128157
  D_ASSERT(bind_data_p);
128162
128158
  auto &bind_data = (const TableScanBindData &)*bind_data_p;
128163
128159
  max_threads = bind_data.table->storage->MaxThreads(context);
@@ -128166,6 +128162,8 @@ struct TableScanGlobalState : public GlobalTableFunctionState {
128166
128162
  ParallelTableScanState state;
128167
128163
  mutex lock;
128168
128164
  idx_t max_threads;
128165
+ //! How many rows we already scanned
128166
+ atomic<idx_t> row_count;
128169
128167
 
128170
128168
  vector<idx_t> projection_ids;
128171
128169
  vector<LogicalType> scanned_types;
@@ -128245,6 +128243,7 @@ static void TableScanFunc(ClientContext &context, TableFunctionInput &data_p, Da
128245
128243
  bind_data.table->storage->Scan(transaction, output, state.scan_state);
128246
128244
  }
128247
128245
  if (output.size() > 0) {
128246
+ gstate.row_count += output.size();
128248
128247
  return;
128249
128248
  }
128250
128249
  if (!TableScanParallelStateNext(context, data_p.bind_data, data_p.local_state, data_p.global_state)) {
@@ -128264,14 +128263,15 @@ bool TableScanParallelStateNext(ClientContext &context, const FunctionData *bind
128264
128263
  }
128265
128264
 
128266
128265
  double TableScanProgress(ClientContext &context, const FunctionData *bind_data_p,
128267
- const GlobalTableFunctionState *gstate) {
128266
+ const GlobalTableFunctionState *gstate_p) {
128268
128267
  auto &bind_data = (TableScanBindData &)*bind_data_p;
128268
+ auto &gstate = (TableScanGlobalState &)*gstate_p;
128269
128269
  idx_t total_rows = bind_data.table->storage->GetTotalRows();
128270
- if (total_rows == 0 || total_rows < STANDARD_VECTOR_SIZE) {
128270
+ if (total_rows == 0) {
128271
128271
  //! Table is either empty or smaller than a vector size, so it is finished
128272
128272
  return 100;
128273
128273
  }
128274
- auto percentage = double(bind_data.chunk_count * STANDARD_VECTOR_SIZE * 100.0) / total_rows;
128274
+ auto percentage = 100 * (double(gstate.row_count) / total_rows);
128275
128275
  if (percentage > 100) {
128276
128276
  //! In case the last chunk has less elements than STANDARD_VECTOR_SIZE, if our percentage is over 100
128277
128277
  //! It means we finished this table.
@@ -128514,7 +128514,6 @@ string TableScanToString(const FunctionData *bind_data_p) {
128514
128514
  static void TableScanSerialize(FieldWriter &writer, const FunctionData *bind_data_p, const TableFunction &function) {
128515
128515
  auto &bind_data = (TableScanBindData &)*bind_data_p;
128516
128516
 
128517
- D_ASSERT(bind_data.chunk_count == 0);
128518
128517
  writer.WriteString(bind_data.table->schema->name);
128519
128518
  writer.WriteString(bind_data.table->name);
128520
128519
  writer.WriteField<bool>(bind_data.is_index_scan);
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 "675d983823"
15
- #define DUCKDB_VERSION "v0.5.2-dev1455"
14
+ #define DUCKDB_SOURCE_ID "42003b707e"
15
+ #define DUCKDB_VERSION "v0.5.2-dev1460"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //