duckdb 0.5.2-dev602.0 → 0.5.2-dev610.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.5.2-dev602.0",
4
+ "version": "0.5.2-dev610.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -118459,7 +118459,8 @@ struct CSVCopyFunction {
118459
118459
  };
118460
118460
 
118461
118461
  struct ReadCSVTableFunction {
118462
- static TableFunction GetFunction();
118462
+ static TableFunction GetFunction(bool list_parameter = false);
118463
+ static TableFunction GetAutoFunction(bool list_parameter = false);
118463
118464
  static void RegisterFunction(BuiltinFunctions &set);
118464
118465
  };
118465
118466
 
@@ -119649,12 +119650,24 @@ static unique_ptr<FunctionData> ReadCSVBind(ClientContext &context, TableFunctio
119649
119650
  auto result = make_unique<ReadCSVData>();
119650
119651
  auto &options = result->options;
119651
119652
 
119652
- auto &file_pattern = StringValue::Get(input.inputs[0]);
119653
+ vector<string> patterns;
119654
+ if (input.inputs[0].type().id() == LogicalTypeId::LIST) {
119655
+ // list of globs
119656
+ for (auto &val : ListValue::GetChildren(input.inputs[0])) {
119657
+ patterns.push_back(StringValue::Get(val));
119658
+ }
119659
+ } else {
119660
+ // single glob pattern
119661
+ patterns.push_back(StringValue::Get(input.inputs[0]));
119662
+ }
119653
119663
 
119654
119664
  auto &fs = FileSystem::GetFileSystem(context);
119655
- result->files = fs.Glob(file_pattern, context);
119656
- if (result->files.empty()) {
119657
- throw IOException("No files found that match the pattern \"%s\"", file_pattern);
119665
+ for (auto &file_pattern : patterns) {
119666
+ auto files = fs.Glob(file_pattern, context);
119667
+ if (files.empty()) {
119668
+ throw IOException("No files found that match the pattern \"%s\"", file_pattern);
119669
+ }
119670
+ result->files.insert(result->files.end(), files.begin(), files.end());
119658
119671
  }
119659
119672
 
119660
119673
  for (auto &kv : input.named_parameters) {
@@ -120022,8 +120035,9 @@ static unique_ptr<FunctionData> CSVReaderDeserialize(ClientContext &context, Fie
120022
120035
  return move(result_data);
120023
120036
  }
120024
120037
 
120025
- TableFunction ReadCSVTableFunction::GetFunction() {
120026
- TableFunction read_csv("read_csv", {LogicalType::VARCHAR}, ReadCSVFunction, ReadCSVBind, ReadCSVInit);
120038
+ TableFunction ReadCSVTableFunction::GetFunction(bool list_parameter) {
120039
+ auto parameter = list_parameter ? LogicalType::LIST(LogicalType::VARCHAR) : LogicalType::VARCHAR;
120040
+ TableFunction read_csv("read_csv", {parameter}, ReadCSVFunction, ReadCSVBind, ReadCSVInit);
120027
120041
  read_csv.table_scan_progress = CSVReaderProgress;
120028
120042
  read_csv.pushdown_complex_filter = CSVComplexFilterPushdown;
120029
120043
  read_csv.serialize = CSVReaderSerialize;
@@ -120032,15 +120046,26 @@ TableFunction ReadCSVTableFunction::GetFunction() {
120032
120046
  return read_csv;
120033
120047
  }
120034
120048
 
120035
- void ReadCSVTableFunction::RegisterFunction(BuiltinFunctions &set) {
120036
- set.AddFunction(ReadCSVTableFunction::GetFunction());
120037
-
120038
- TableFunction read_csv_auto("read_csv_auto", {LogicalType::VARCHAR}, ReadCSVFunction, ReadCSVAutoBind, ReadCSVInit);
120049
+ TableFunction ReadCSVTableFunction::GetAutoFunction(bool list_parameter) {
120050
+ auto parameter = list_parameter ? LogicalType::LIST(LogicalType::VARCHAR) : LogicalType::VARCHAR;
120051
+ TableFunction read_csv_auto("read_csv_auto", {parameter}, ReadCSVFunction, ReadCSVAutoBind, ReadCSVInit);
120039
120052
  read_csv_auto.table_scan_progress = CSVReaderProgress;
120040
120053
  read_csv_auto.pushdown_complex_filter = CSVComplexFilterPushdown;
120041
120054
  read_csv_auto.serialize = CSVReaderSerialize;
120042
120055
  read_csv_auto.deserialize = CSVReaderDeserialize;
120043
120056
  ReadCSVAddNamedParameters(read_csv_auto);
120057
+ return read_csv_auto;
120058
+ }
120059
+
120060
+ void ReadCSVTableFunction::RegisterFunction(BuiltinFunctions &set) {
120061
+ TableFunctionSet read_csv("read_csv");
120062
+ read_csv.AddFunction(ReadCSVTableFunction::GetFunction());
120063
+ read_csv.AddFunction(ReadCSVTableFunction::GetFunction(true));
120064
+ set.AddFunction(read_csv);
120065
+
120066
+ TableFunctionSet read_csv_auto("read_csv_auto");
120067
+ read_csv_auto.AddFunction(ReadCSVTableFunction::GetAutoFunction());
120068
+ read_csv_auto.AddFunction(ReadCSVTableFunction::GetAutoFunction(true));
120044
120069
  set.AddFunction(read_csv_auto);
120045
120070
  }
120046
120071
 
@@ -141465,8 +141490,10 @@ namespace duckdb {
141465
141490
  class CreateViewRelation : public Relation {
141466
141491
  public:
141467
141492
  CreateViewRelation(shared_ptr<Relation> child, string view_name, bool replace, bool temporary);
141493
+ CreateViewRelation(shared_ptr<Relation> child, string schema_name, string view_name, bool replace, bool temporary);
141468
141494
 
141469
141495
  shared_ptr<Relation> child;
141496
+ string schema_name;
141470
141497
  string view_name;
141471
141498
  bool replace;
141472
141499
  bool temporary;
@@ -141496,6 +141523,13 @@ CreateViewRelation::CreateViewRelation(shared_ptr<Relation> child_p, string view
141496
141523
  context.GetContext()->TryBindRelation(*this, this->columns);
141497
141524
  }
141498
141525
 
141526
+ CreateViewRelation::CreateViewRelation(shared_ptr<Relation> child_p, string schema_name_p, string view_name_p,
141527
+ bool replace_p, bool temporary_p)
141528
+ : Relation(child_p->context, RelationType::CREATE_VIEW_RELATION), child(move(child_p)),
141529
+ schema_name(move(schema_name_p)), view_name(move(view_name_p)), replace(replace_p), temporary(temporary_p) {
141530
+ context.GetContext()->TryBindRelation(*this, this->columns);
141531
+ }
141532
+
141499
141533
  BoundStatement CreateViewRelation::Bind(Binder &binder) {
141500
141534
  auto select = make_unique<SelectStatement>();
141501
141535
  select->node = child->GetQueryNode();
@@ -141505,7 +141539,7 @@ BoundStatement CreateViewRelation::Bind(Binder &binder) {
141505
141539
  info->query = move(select);
141506
141540
  info->view_name = view_name;
141507
141541
  info->temporary = temporary;
141508
- info->schema = "";
141542
+ info->schema = schema_name;
141509
141543
  info->on_conflict = replace ? OnCreateConflict::REPLACE_ON_CONFLICT : OnCreateConflict::ERROR_ON_CONFLICT;
141510
141544
  stmt.info = move(info);
141511
141545
  return binder.Bind((SQLStatement &)stmt);
@@ -143537,6 +143571,16 @@ shared_ptr<Relation> Relation::CreateView(const string &name, bool replace, bool
143537
143571
  return shared_from_this();
143538
143572
  }
143539
143573
 
143574
+ shared_ptr<Relation> Relation::CreateView(const string &schema_name, const string &name, bool replace, bool temporary) {
143575
+ auto view = make_shared<CreateViewRelation>(shared_from_this(), schema_name, name, replace, temporary);
143576
+ auto res = view->Execute();
143577
+ if (res->HasError()) {
143578
+ const string prepended_message = "Failed to create view '" + name + "': ";
143579
+ res->ThrowError(prepended_message);
143580
+ }
143581
+ return shared_from_this();
143582
+ }
143583
+
143540
143584
  unique_ptr<QueryResult> Relation::Query(const string &sql) {
143541
143585
  return context.GetContext()->Query(sql, false);
143542
143586
  }
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 "2c41da9ac"
15
- #define DUCKDB_VERSION "v0.5.2-dev602"
14
+ #define DUCKDB_SOURCE_ID "41f579d27"
15
+ #define DUCKDB_VERSION "v0.5.2-dev610"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -23699,6 +23699,8 @@ public:
23699
23699
  DUCKDB_API void Head(idx_t limit = 10);
23700
23700
 
23701
23701
  DUCKDB_API shared_ptr<Relation> CreateView(const string &name, bool replace = true, bool temporary = false);
23702
+ DUCKDB_API shared_ptr<Relation> CreateView(const string &schema_name, const string &name, bool replace = true,
23703
+ bool temporary = false);
23702
23704
  DUCKDB_API unique_ptr<QueryResult> Query(const string &sql);
23703
23705
  DUCKDB_API unique_ptr<QueryResult> Query(const string &name, const string &sql);
23704
23706