duckdb 0.3.3-dev1279.0 → 0.3.3-dev1293.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-dev1279.0",
4
+ "version": "0.3.3-dev1293.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];
@@ -153884,6 +153891,9 @@ unique_ptr<BoundResultModifier> Binder::BindLimit(LimitModifier &limit_mod) {
153884
153891
  result->limit = BindDelimiter(context, move(limit_mod.limit), LogicalType::BIGINT, val);
153885
153892
  if (!result->limit) {
153886
153893
  result->limit_val = val.GetValue<int64_t>();
153894
+ if (result->limit_val < 0) {
153895
+ throw BinderException("LIMIT cannot be negative");
153896
+ }
153887
153897
  }
153888
153898
  }
153889
153899
  if (limit_mod.offset) {
@@ -153891,6 +153901,9 @@ unique_ptr<BoundResultModifier> Binder::BindLimit(LimitModifier &limit_mod) {
153891
153901
  result->offset = BindDelimiter(context, move(limit_mod.offset), LogicalType::BIGINT, val);
153892
153902
  if (!result->offset) {
153893
153903
  result->offset_val = val.GetValue<int64_t>();
153904
+ if (result->offset_val < 0) {
153905
+ throw BinderException("OFFSET cannot be negative");
153906
+ }
153894
153907
  }
153895
153908
  }
153896
153909
  return move(result);
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 "f1278198b"
15
- #define DUCKDB_VERSION "v0.3.3-dev1279"
14
+ #define DUCKDB_SOURCE_ID "d1cbbb44c"
15
+ #define DUCKDB_VERSION "v0.3.3-dev1293"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //