duckdb 0.4.1-dev1562.0 → 0.4.1-dev1564.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.4.1-dev1562.0",
4
+ "version": "0.4.1-dev1564.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -120346,6 +120346,7 @@ duckdb_data_chunk duckdb_result_get_chunk(duckdb_result result, idx_t chunk_idx)
120346
120346
 
120347
120347
 
120348
120348
 
120349
+
120349
120350
  namespace duckdb {
120350
120351
 
120351
120352
  struct CTableFunctionInfo : public TableFunctionInfo {
@@ -120377,6 +120378,7 @@ struct CTableBindData : public TableFunctionData {
120377
120378
  CTableFunctionInfo *info = nullptr;
120378
120379
  void *bind_data = nullptr;
120379
120380
  duckdb_delete_callback_t delete_callback = nullptr;
120381
+ unique_ptr<NodeStatistics> stats;
120380
120382
  };
120381
120383
 
120382
120384
  struct CTableInternalBindInfo {
@@ -120491,6 +120493,14 @@ unique_ptr<LocalTableFunctionState> CTableFunctionLocalInit(ExecutionContext &co
120491
120493
  return move(result);
120492
120494
  }
120493
120495
 
120496
+ unique_ptr<NodeStatistics> CTableFunctionCardinality(ClientContext &context, const FunctionData *bind_data_p) {
120497
+ auto &bind_data = (const CTableBindData &)*bind_data_p;
120498
+ if (!bind_data.stats) {
120499
+ return nullptr;
120500
+ }
120501
+ return make_unique<NodeStatistics>(*bind_data.stats);
120502
+ }
120503
+
120494
120504
  void CTableFunction(ClientContext &context, TableFunctionInput &data_p, DataChunk &output) {
120495
120505
  auto &bind_data = (CTableBindData &)*data_p.bind_data;
120496
120506
  auto &global_data = (CTableGlobalInitData &)*data_p.global_state;
@@ -120511,6 +120521,7 @@ duckdb_table_function duckdb_create_table_function() {
120511
120521
  auto function = new duckdb::TableFunction("", {}, duckdb::CTableFunction, duckdb::CTableFunctionBind,
120512
120522
  duckdb::CTableFunctionInit, duckdb::CTableFunctionLocalInit);
120513
120523
  function->function_info = duckdb::make_shared<duckdb::CTableFunctionInfo>();
120524
+ function->cardinality = duckdb::CTableFunctionCardinality;
120514
120525
  return function;
120515
120526
  }
120516
120527
 
@@ -120659,6 +120670,18 @@ void duckdb_bind_set_bind_data(duckdb_bind_info info, void *bind_data, duckdb_de
120659
120670
  bind_info->bind_data.delete_callback = destroy;
120660
120671
  }
120661
120672
 
120673
+ void duckdb_bind_set_cardinality(duckdb_bind_info info, idx_t cardinality, bool is_exact) {
120674
+ if (!info) {
120675
+ return;
120676
+ }
120677
+ auto bind_info = (duckdb::CTableInternalBindInfo *)info;
120678
+ if (is_exact) {
120679
+ bind_info->bind_data.stats = duckdb::make_unique<duckdb::NodeStatistics>(cardinality);
120680
+ } else {
120681
+ bind_info->bind_data.stats = duckdb::make_unique<duckdb::NodeStatistics>(cardinality, cardinality);
120682
+ }
120683
+ }
120684
+
120662
120685
  void duckdb_bind_set_error(duckdb_bind_info info, const char *error) {
120663
120686
  if (!info || !error) {
120664
120687
  return;
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 "5fdf4a947"
15
- #define DUCKDB_VERSION "v0.4.1-dev1562"
14
+ #define DUCKDB_SOURCE_ID "ebe45abbb"
15
+ #define DUCKDB_VERSION "v0.4.1-dev1564"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -17860,6 +17860,14 @@ Sets the user-provided bind data in the bind object. This object can be retrieve
17860
17860
  */
17861
17861
  DUCKDB_API void duckdb_bind_set_bind_data(duckdb_bind_info info, void *bind_data, duckdb_delete_callback_t destroy);
17862
17862
 
17863
+ /*!
17864
+ Sets the cardinality estimate for the table function, used for optimization.
17865
+
17866
+ * info: The bind data object.
17867
+ * is_exact: Whether or not the cardinality estimate is exact, or an approximation
17868
+ */
17869
+ DUCKDB_API void duckdb_bind_set_cardinality(duckdb_bind_info info, idx_t cardinality, bool is_exact);
17870
+
17863
17871
  /*!
17864
17872
  Report that an error has occurred while calling bind.
17865
17873