duckdb 0.3.1-dev631.0 → 0.3.1-dev657.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.1-dev631.0",
4
+ "version": "0.3.1-dev657.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -102251,11 +102251,16 @@ namespace duckdb {
102251
102251
 
102252
102252
  class TableFunctionRelation : public Relation {
102253
102253
  public:
102254
+ TableFunctionRelation(ClientContext &context, string name, vector<Value> parameters,
102255
+ unordered_map<string, Value> named_parameters,
102256
+ shared_ptr<Relation> input_relation_p = nullptr);
102257
+
102254
102258
  TableFunctionRelation(ClientContext &context, string name, vector<Value> parameters,
102255
102259
  shared_ptr<Relation> input_relation_p = nullptr);
102256
102260
 
102257
102261
  string name;
102258
102262
  vector<Value> parameters;
102263
+ unordered_map<string, Value> named_parameters;
102259
102264
  vector<ColumnDefinition> columns;
102260
102265
  shared_ptr<Relation> input_relation;
102261
102266
 
@@ -102523,7 +102528,13 @@ shared_ptr<Relation> Connection::View(const string &schema_name, const string &t
102523
102528
 
102524
102529
  shared_ptr<Relation> Connection::TableFunction(const string &fname) {
102525
102530
  vector<Value> values;
102526
- return TableFunction(fname, values);
102531
+ unordered_map<string, Value> named_parameters;
102532
+ return TableFunction(fname, values, named_parameters);
102533
+ }
102534
+
102535
+ shared_ptr<Relation> Connection::TableFunction(const string &fname, const vector<Value> &values,
102536
+ const unordered_map<string, Value> &named_parameters) {
102537
+ return make_shared<TableFunctionRelation>(*context, fname, values, named_parameters);
102527
102538
  }
102528
102539
 
102529
102540
  shared_ptr<Relation> Connection::TableFunction(const string &fname, const vector<Value> &values) {
@@ -102672,6 +102683,33 @@ private:
102672
102683
 
102673
102684
 
102674
102685
 
102686
+ //===----------------------------------------------------------------------===//
102687
+ // DuckDB
102688
+ //
102689
+ // duckdb/main/extension_helper.hpp
102690
+ //
102691
+ //
102692
+ //===----------------------------------------------------------------------===//
102693
+
102694
+
102695
+
102696
+ #include <string>
102697
+
102698
+
102699
+ namespace duckdb {
102700
+ class DuckDB;
102701
+
102702
+ enum class ExtensionLoadResult : uint8_t { LOADED_EXTENSION = 0, EXTENSION_UNKNOWN = 1, NOT_LOADED = 2 };
102703
+
102704
+ class ExtensionHelper {
102705
+ public:
102706
+ static void LoadAllExtensions(DuckDB &db);
102707
+
102708
+ static ExtensionLoadResult LoadExtension(DuckDB &db, const std::string &extension);
102709
+ };
102710
+
102711
+ } // namespace duckdb
102712
+
102675
102713
 
102676
102714
  #ifndef DUCKDB_NO_THREADS
102677
102715
 
@@ -102797,6 +102835,9 @@ void DatabaseInstance::Initialize(const char *path, DBConfig *new_config) {
102797
102835
 
102798
102836
  DuckDB::DuckDB(const char *path, DBConfig *new_config) : instance(make_shared<DatabaseInstance>()) {
102799
102837
  instance->Initialize(path, new_config);
102838
+ if (instance->config.load_extensions) {
102839
+ ExtensionHelper::LoadAllExtensions(*this);
102840
+ }
102800
102841
  }
102801
102842
 
102802
102843
  DuckDB::DuckDB(const string &path, DBConfig *config) : DuckDB(path.c_str(), config) {
@@ -102868,6 +102909,7 @@ void DatabaseInstance::Configure(DBConfig &new_config) {
102868
102909
  } else {
102869
102910
  config.maximum_threads = new_config.maximum_threads;
102870
102911
  }
102912
+ config.load_extensions = new_config.load_extensions;
102871
102913
  config.force_compression = new_config.force_compression;
102872
102914
  config.allocator = move(new_config.allocator);
102873
102915
  config.checkpoint_wal_size = new_config.checkpoint_wal_size;
@@ -102897,6 +102939,102 @@ idx_t DuckDB::NumberOfThreads() {
102897
102939
  } // namespace duckdb
102898
102940
 
102899
102941
 
102942
+ #ifdef BUILD_ICU_EXTENSION
102943
+ #include "icu-extension.hpp"
102944
+ #endif
102945
+
102946
+ #ifdef BUILD_PARQUET_EXTENSION
102947
+ #include "parquet-extension.hpp"
102948
+ #endif
102949
+
102950
+ #ifdef BUILD_TPCH_EXTENSION
102951
+ #include "tpch-extension.hpp"
102952
+ #endif
102953
+
102954
+ #ifdef BUILD_TPCDS_EXTENSION
102955
+ #include "tpcds-extension.hpp"
102956
+ #endif
102957
+
102958
+ #ifdef BUILD_FTS_EXTENSION
102959
+ #include "fts-extension.hpp"
102960
+ #endif
102961
+
102962
+ #ifdef BUILD_HTTPFS_EXTENSION
102963
+ #include "httpfs-extension.hpp"
102964
+ #endif
102965
+
102966
+ #ifdef BUILD_VISUALIZER_EXTENSION
102967
+ #include "visualizer-extension.hpp"
102968
+ #endif
102969
+
102970
+ namespace duckdb {
102971
+
102972
+ void ExtensionHelper::LoadAllExtensions(DuckDB &db) {
102973
+ unordered_set<string> extensions {"parquet", "icu", "tpch", "tpcds", "fts", "httpfs", "visualizer"};
102974
+ for (auto &ext : extensions) {
102975
+ LoadExtension(db, ext);
102976
+ }
102977
+ }
102978
+
102979
+ ExtensionLoadResult ExtensionHelper::LoadExtension(DuckDB &db, const std::string &extension) {
102980
+ if (extension == "parquet") {
102981
+ #ifdef BUILD_PARQUET_EXTENSION
102982
+ db.LoadExtension<ParquetExtension>();
102983
+ #else
102984
+ // parquet extension required but not build: skip this test
102985
+ return ExtensionLoadResult::NOT_LOADED;
102986
+ #endif
102987
+ } else if (extension == "icu") {
102988
+ #ifdef BUILD_ICU_EXTENSION
102989
+ db.LoadExtension<ICUExtension>();
102990
+ #else
102991
+ // icu extension required but not build: skip this test
102992
+ return ExtensionLoadResult::NOT_LOADED;
102993
+ #endif
102994
+ } else if (extension == "tpch") {
102995
+ #ifdef BUILD_TPCH_EXTENSION
102996
+ db.LoadExtension<TPCHExtension>();
102997
+ #else
102998
+ // icu extension required but not build: skip this test
102999
+ return ExtensionLoadResult::NOT_LOADED;
103000
+ #endif
103001
+ } else if (extension == "tpcds") {
103002
+ #ifdef BUILD_TPCDS_EXTENSION
103003
+ db.LoadExtension<TPCDSExtension>();
103004
+ #else
103005
+ // icu extension required but not build: skip this test
103006
+ return ExtensionLoadResult::NOT_LOADED;
103007
+ #endif
103008
+ } else if (extension == "fts") {
103009
+ #ifdef BUILD_FTS_EXTENSION
103010
+ db.LoadExtension<FTSExtension>();
103011
+ #else
103012
+ // fts extension required but not build: skip this test
103013
+ return ExtensionLoadResult::NOT_LOADED;
103014
+ #endif
103015
+ } else if (extension == "httpfs") {
103016
+ #ifdef BUILD_HTTPFS_EXTENSION
103017
+ db.LoadExtension<HTTPFsExtension>();
103018
+ #else
103019
+ return ExtensionLoadResult::NOT_LOADED;
103020
+ #endif
103021
+ } else if (extension == "visualizer") {
103022
+ #ifdef BUILD_VISUALIZER_EXTENSION
103023
+ db.LoadExtension<VisualizerExtension>();
103024
+ #else
103025
+ // visualizer extension required but not build: skip this test
103026
+ return ExtensionLoadResult::NOT_LOADED;
103027
+ #endif
103028
+ } else {
103029
+ // unknown extension
103030
+ return ExtensionLoadResult::EXTENSION_UNKNOWN;
103031
+ }
103032
+ return ExtensionLoadResult::LOADED_EXTENSION;
103033
+ }
103034
+
103035
+ } // namespace duckdb
103036
+
103037
+
102900
103038
 
102901
103039
  namespace duckdb {
102902
103040
 
@@ -105615,9 +105753,19 @@ public:
105615
105753
 
105616
105754
 
105617
105755
 
105756
+
105757
+
105618
105758
  namespace duckdb {
105619
105759
 
105620
105760
  TableFunctionRelation::TableFunctionRelation(ClientContext &context, string name_p, vector<Value> parameters_p,
105761
+ unordered_map<string, Value> named_parameters,
105762
+ shared_ptr<Relation> input_relation_p)
105763
+ : Relation(context, RelationType::TABLE_FUNCTION_RELATION), name(move(name_p)), parameters(move(parameters_p)),
105764
+ named_parameters(move(named_parameters)), input_relation(move(input_relation_p)) {
105765
+ context.TryBindRelation(*this, this->columns);
105766
+ }
105767
+ TableFunctionRelation::TableFunctionRelation(ClientContext &context, string name_p, vector<Value> parameters_p,
105768
+
105621
105769
  shared_ptr<Relation> input_relation_p)
105622
105770
  : Relation(context, RelationType::TABLE_FUNCTION_RELATION), name(move(name_p)), parameters(move(parameters_p)),
105623
105771
  input_relation(move(input_relation_p)) {
@@ -105644,6 +105792,17 @@ unique_ptr<TableRef> TableFunctionRelation::GetTableRef() {
105644
105792
  children.push_back(make_unique<ConstantExpression>(parameter));
105645
105793
  }
105646
105794
 
105795
+ for (auto &parameter : named_parameters) {
105796
+ // Hackity-hack some comparisons with column refs
105797
+ // This is all but pretty, basically the named parameter is the column, the table is empty because that's what
105798
+ // the function binder likes
105799
+ auto column_ref = make_unique<ColumnRefExpression>(parameter.first);
105800
+ auto constant_value = make_unique<ConstantExpression>(parameter.second);
105801
+ auto comparison =
105802
+ make_unique<ComparisonExpression>(ExpressionType::COMPARE_EQUAL, move(column_ref), move(constant_value));
105803
+ children.push_back(move(comparison));
105804
+ }
105805
+
105647
105806
  auto table_function = make_unique<TableFunctionRef>();
105648
105807
  auto function = make_unique<FunctionExpression>(name, move(children));
105649
105808
  table_function->function = move(function);
@@ -106388,6 +106547,11 @@ void Relation::Delete(const string &condition) {
106388
106547
  throw Exception("DELETE can only be used on base tables!");
106389
106548
  }
106390
106549
 
106550
+ shared_ptr<Relation> Relation::TableFunction(const std::string &fname, const vector<Value> &values,
106551
+ const unordered_map<string, Value> &named_parameters) {
106552
+ return make_shared<TableFunctionRelation>(context, fname, values, named_parameters, shared_from_this());
106553
+ }
106554
+
106391
106555
  shared_ptr<Relation> Relation::TableFunction(const std::string &fname, const vector<Value> &values) {
106392
106556
  return make_shared<TableFunctionRelation>(context, fname, values, shared_from_this());
106393
106557
  }
package/src/duckdb.hpp CHANGED
@@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
10
10
 
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
- #define DUCKDB_SOURCE_ID "1d4d32326"
14
- #define DUCKDB_VERSION "0.3.1-dev631"
13
+ #define DUCKDB_SOURCE_ID "0385e028a"
14
+ #define DUCKDB_VERSION "0.3.1-dev657"
15
15
  //===----------------------------------------------------------------------===//
16
16
  // DuckDB
17
17
  //
@@ -9228,6 +9228,7 @@ string RelationTypeToString(RelationType type);
9228
9228
 
9229
9229
 
9230
9230
 
9231
+
9231
9232
  #include <memory>
9232
9233
 
9233
9234
  namespace duckdb {
@@ -9331,7 +9332,10 @@ public:
9331
9332
  //! Delete from a table, can only be used on a TableRelation
9332
9333
  DUCKDB_API virtual void Delete(const string &condition = string());
9333
9334
  //! Create a relation from calling a table in/out function on the input relation
9335
+ //! Create a relation from calling a table in/out function on the input relation
9334
9336
  DUCKDB_API shared_ptr<Relation> TableFunction(const std::string &fname, const vector<Value> &values);
9337
+ DUCKDB_API shared_ptr<Relation> TableFunction(const std::string &fname, const vector<Value> &values,
9338
+ const unordered_map<string, Value> &named_parameters);
9335
9339
 
9336
9340
  public:
9337
9341
  //! Whether or not the relation inherits column bindings from its child or not, only relevant for binding
@@ -9574,6 +9578,8 @@ public:
9574
9578
  DUCKDB_API shared_ptr<Relation> View(const string &schema_name, const string &table_name);
9575
9579
  //! Returns a relation that calls a specified table function
9576
9580
  DUCKDB_API shared_ptr<Relation> TableFunction(const string &tname);
9581
+ DUCKDB_API shared_ptr<Relation> TableFunction(const string &tname, const vector<Value> &values,
9582
+ const unordered_map<string, Value> &named_parameters);
9577
9583
  DUCKDB_API shared_ptr<Relation> TableFunction(const string &tname, const vector<Value> &values);
9578
9584
  //! Returns a relation that produces values
9579
9585
  DUCKDB_API shared_ptr<Relation> Values(const vector<vector<Value>> &values);
@@ -10107,6 +10113,8 @@ public:
10107
10113
  idx_t checkpoint_wal_size = 1 << 24;
10108
10114
  //! Whether or not to use Direct IO, bypassing operating system buffers
10109
10115
  bool use_direct_io = false;
10116
+ //! Whether extensions should be loaded on start-up
10117
+ bool load_extensions = true;
10110
10118
  //! The FileSystem to use, can be overwritten to allow for injecting custom file systems for testing purposes (e.g.
10111
10119
  //! RamFS or something similar)
10112
10120
  unique_ptr<FileSystem> file_system;