duckdb 0.3.3-dev1275.0 → 0.3.3-dev1291.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.3.3-dev1275.0",
4
+ "version": "0.3.3-dev1291.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -96977,9 +96977,14 @@ unique_ptr<FunctionData> ArrowTableFunction::ArrowScanBind(ClientContext &contex
96977
96977
  uintptr_t stream_factory_ptr,
96978
96978
  std::pair<std::unordered_map<idx_t, string>, std::vector<string>> & project_columns,
96979
96979
  TableFilterCollection * filters);
96980
+
96981
+ typedef void (*stream_factory_get_schema_t)(uintptr_t stream_factory_ptr, ArrowSchemaWrapper & schema);
96982
+
96980
96983
  auto stream_factory_ptr = input.inputs[0].GetPointer();
96981
96984
  auto stream_factory_produce = (stream_factory_produce_t)input.inputs[1].GetPointer();
96982
- auto rows_per_thread = input.inputs[2].GetValue<uint64_t>();
96985
+ auto stream_factory_get_schema = (stream_factory_get_schema_t)input.inputs[2].GetPointer();
96986
+ auto rows_per_thread = input.inputs[3].GetValue<uint64_t>();
96987
+
96983
96988
  std::pair<std::unordered_map<idx_t, string>, std::vector<string>> project_columns;
96984
96989
  #ifndef DUCKDB_NO_THREADS
96985
96990
 
@@ -96989,15 +96994,7 @@ unique_ptr<FunctionData> ArrowTableFunction::ArrowScanBind(ClientContext &contex
96989
96994
  auto res = make_unique<ArrowScanFunctionData>(rows_per_thread, stream_factory_produce, stream_factory_ptr);
96990
96995
  #endif
96991
96996
  auto &data = *res;
96992
- auto stream = stream_factory_produce(stream_factory_ptr, project_columns, nullptr);
96993
-
96994
- data.number_of_rows = stream->number_of_rows;
96995
- if (!stream) {
96996
- throw InvalidInputException("arrow_scan: NULL pointer passed");
96997
- }
96998
-
96999
- stream->GetSchema(data.schema_root);
97000
-
96997
+ stream_factory_get_schema(stream_factory_ptr, data.schema_root);
97001
96998
  for (idx_t col_idx = 0; col_idx < (idx_t)data.schema_root.arrow_schema.n_children; col_idx++) {
97002
96999
  auto &schema = *data.schema_root.arrow_schema.children[col_idx];
97003
97000
  if (!schema.release) {
@@ -97907,11 +97904,11 @@ double ArrowTableFunction::ArrowProgress(ClientContext &context, const FunctionD
97907
97904
 
97908
97905
  void ArrowTableFunction::RegisterFunction(BuiltinFunctions &set) {
97909
97906
  TableFunctionSet arrow("arrow_scan");
97910
- arrow.AddFunction(TableFunction({LogicalType::POINTER, LogicalType::POINTER, LogicalType::UBIGINT},
97911
- ArrowScanFunction, ArrowScanBind, ArrowScanInit, nullptr, nullptr, nullptr,
97912
- ArrowScanCardinality, nullptr, nullptr, ArrowScanMaxThreads,
97913
- ArrowScanInitParallelState, ArrowScanFunctionParallel, ArrowScanParallelInit,
97914
- ArrowScanParallelStateNext, true, true, ArrowProgress));
97907
+ arrow.AddFunction(
97908
+ TableFunction({LogicalType::POINTER, LogicalType::POINTER, LogicalType::POINTER, LogicalType::UBIGINT},
97909
+ ArrowScanFunction, ArrowScanBind, ArrowScanInit, nullptr, nullptr, nullptr, ArrowScanCardinality,
97910
+ nullptr, nullptr, ArrowScanMaxThreads, ArrowScanInitParallelState, ArrowScanFunctionParallel,
97911
+ ArrowScanParallelInit, ArrowScanParallelStateNext, true, true, ArrowProgress));
97915
97912
  set.AddFunction(arrow);
97916
97913
  }
97917
97914
 
@@ -106099,11 +106096,21 @@ RESULT_TYPE TryCastCInternal(duckdb_result *result, idx_t col, idx_t row) {
106099
106096
  return result_value;
106100
106097
  }
106101
106098
 
106102
- static bool CanFetchValue(duckdb_result *result, idx_t col, idx_t row) {
106099
+ static bool CanUseDeprecatedFetch(duckdb_result *result, idx_t col, idx_t row) {
106100
+ if (!result) {
106101
+ return false;
106102
+ }
106103
106103
  if (!duckdb::deprecated_materialize_result(result)) {
106104
106104
  return false;
106105
106105
  }
106106
- if (!result || col >= result->__deprecated_column_count || row >= result->__deprecated_row_count) {
106106
+ if (col >= result->__deprecated_column_count || row >= result->__deprecated_row_count) {
106107
+ return false;
106108
+ }
106109
+ return true;
106110
+ }
106111
+
106112
+ static bool CanFetchValue(duckdb_result *result, idx_t col, idx_t row) {
106113
+ if (!CanUseDeprecatedFetch(result, col, row)) {
106107
106114
  return false;
106108
106115
  }
106109
106116
  if (result->__deprecated_columns[col].__deprecated_nullmask[row]) {
@@ -106285,7 +106292,7 @@ duckdb_blob duckdb_value_blob(duckdb_result *result, idx_t col, idx_t row) {
106285
106292
  }
106286
106293
 
106287
106294
  bool duckdb_value_is_null(duckdb_result *result, idx_t col, idx_t row) {
106288
- if (!result || col >= result->__deprecated_column_count || row >= result->__deprecated_row_count) {
106295
+ if (!CanUseDeprecatedFetch(result, col, row)) {
106289
106296
  return false;
106290
106297
  }
106291
106298
  return result->__deprecated_columns[col].__deprecated_nullmask[row];
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 "2ff182df8"
15
- #define DUCKDB_VERSION "v0.3.3-dev1275"
14
+ #define DUCKDB_SOURCE_ID "261c21b49"
15
+ #define DUCKDB_VERSION "v0.3.3-dev1291"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -5504,10 +5504,9 @@ class CycleCounter {
5504
5504
  friend struct ExpressionInfo;
5505
5505
  friend struct ExpressionRootInfo;
5506
5506
  static constexpr int SAMPLING_RATE = 50;
5507
- static constexpr int SAMPLING_VARIANCE = 100;
5508
5507
 
5509
5508
  public:
5510
- CycleCounter() : random(-1) {
5509
+ CycleCounter() {
5511
5510
  }
5512
5511
  // Next_sample determines if a sample needs to be taken, if so start the profiler
5513
5512
  void BeginSample() {
@@ -5522,7 +5521,7 @@ public:
5522
5521
  time += Tick() - tmp;
5523
5522
  }
5524
5523
  if (current_count >= next_sample) {
5525
- next_sample = SAMPLING_RATE + random.NextRandomInteger() % SAMPLING_VARIANCE;
5524
+ next_sample = SAMPLING_RATE;
5526
5525
  ++sample_count;
5527
5526
  sample_tuples_count += chunk_size;
5528
5527
  current_count = 0;
@@ -5548,8 +5547,6 @@ private:
5548
5547
  uint64_t sample_tuples_count = 0;
5549
5548
  //! Count the number of ALL tuples
5550
5549
  uint64_t tuples_count = 0;
5551
- //! the random number generator used for sampling
5552
- RandomEngine random;
5553
5550
  };
5554
5551
 
5555
5552
  } // namespace duckdb