duckdb 0.6.2-dev29.0 → 0.6.2-dev32.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
@@ -2,7 +2,7 @@
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
4
  "types": "./lib/duckdb.d.ts",
5
- "version": "0.6.2-dev29.0",
5
+ "version": "0.6.2-dev32.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -131116,6 +131116,10 @@ idx_t TableScanGetBatchIndex(ClientContext &context, const FunctionData *bind_da
131116
131116
  return 0;
131117
131117
  }
131118
131118
 
131119
+ BindInfo TableScanGetBindInfo(const FunctionData *bind_data) {
131120
+ return BindInfo(ScanType::TABLE);
131121
+ }
131122
+
131119
131123
  void TableScanDependency(unordered_set<CatalogEntry *> &entries, const FunctionData *bind_data_p) {
131120
131124
  auto &bind_data = (const TableScanBindData &)*bind_data_p;
131121
131125
  entries.insert(bind_data.table);
@@ -131395,6 +131399,7 @@ TableFunction TableScanFunction::GetFunction() {
131395
131399
  scan_function.to_string = TableScanToString;
131396
131400
  scan_function.table_scan_progress = TableScanProgress;
131397
131401
  scan_function.get_batch_index = TableScanGetBatchIndex;
131402
+ scan_function.get_batch_info = TableScanGetBindInfo;
131398
131403
  scan_function.projection_pushdown = true;
131399
131404
  scan_function.filter_pushdown = true;
131400
131405
  scan_function.filter_prune = true;
@@ -131613,8 +131618,9 @@ TableFunction::TableFunction(string name, vector<LogicalType> arguments, table_f
131613
131618
  : SimpleNamedParameterFunction(move(name), move(arguments)), bind(bind), init_global(init_global),
131614
131619
  init_local(init_local), function(function), in_out_function(nullptr), in_out_function_final(nullptr),
131615
131620
  statistics(nullptr), dependency(nullptr), cardinality(nullptr), pushdown_complex_filter(nullptr),
131616
- to_string(nullptr), table_scan_progress(nullptr), get_batch_index(nullptr), serialize(nullptr),
131617
- deserialize(nullptr), projection_pushdown(false), filter_pushdown(false), filter_prune(false) {
131621
+ to_string(nullptr), table_scan_progress(nullptr), get_batch_index(nullptr), get_batch_info(nullptr),
131622
+ serialize(nullptr), deserialize(nullptr), projection_pushdown(false), filter_pushdown(false),
131623
+ filter_prune(false) {
131618
131624
  }
131619
131625
 
131620
131626
  TableFunction::TableFunction(const vector<LogicalType> &arguments, table_function_t function,
@@ -131626,8 +131632,8 @@ TableFunction::TableFunction()
131626
131632
  : SimpleNamedParameterFunction("", {}), bind(nullptr), init_global(nullptr), init_local(nullptr), function(nullptr),
131627
131633
  in_out_function(nullptr), statistics(nullptr), dependency(nullptr), cardinality(nullptr),
131628
131634
  pushdown_complex_filter(nullptr), to_string(nullptr), table_scan_progress(nullptr), get_batch_index(nullptr),
131629
- serialize(nullptr), deserialize(nullptr), projection_pushdown(false), filter_pushdown(false),
131630
- filter_prune(false) {
131635
+ get_batch_info(nullptr), serialize(nullptr), deserialize(nullptr), projection_pushdown(false),
131636
+ filter_pushdown(false), filter_prune(false) {
131631
131637
  }
131632
131638
 
131633
131639
  } // namespace duckdb
@@ -138358,6 +138364,13 @@ shared_ptr<Relation> Connection::ReadCSV(const string &csv_file, const vector<st
138358
138364
  return make_shared<ReadCSVRelation>(context, csv_file, move(column_list));
138359
138365
  }
138360
138366
 
138367
+ shared_ptr<Relation> Connection::ReadParquet(const string &parquet_file, bool binary_as_string) {
138368
+ vector<Value> params;
138369
+ params.emplace_back(parquet_file);
138370
+ named_parameter_map_t named_parameters({{"binary_as_string", Value::BOOLEAN(binary_as_string)}});
138371
+ return TableFunction("parquet_scan", params, named_parameters)->Alias(parquet_file);
138372
+ }
138373
+
138361
138374
  unordered_set<string> Connection::GetTableNames(const string &query) {
138362
138375
  return context->GetTableNames(query);
138363
138376
  }
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 "0f2becd686"
15
- #define DUCKDB_VERSION "v0.6.2-dev29"
14
+ #define DUCKDB_SOURCE_ID "d7a5a682c4"
15
+ #define DUCKDB_VERSION "v0.6.2-dev32"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -13911,6 +13911,44 @@ public:
13911
13911
  GlobalTableFunctionState *global_state;
13912
13912
  };
13913
13913
 
13914
+ enum ScanType { TABLE, PARQUET };
13915
+
13916
+ struct BindInfo {
13917
+ public:
13918
+ explicit BindInfo(ScanType type_p) : type(type_p) {};
13919
+ unordered_map<string, Value> options;
13920
+ ScanType type;
13921
+ void InsertOption(string name, Value value) {
13922
+ if (options.find(name) != options.end()) {
13923
+ throw InternalException("This option already exists");
13924
+ }
13925
+ options[name] = value;
13926
+ }
13927
+ template <class T>
13928
+ T GetOption(string name) {
13929
+ if (options.find(name) == options.end()) {
13930
+ throw InternalException("This option does not exist");
13931
+ }
13932
+ return options[name].GetValue<T>();
13933
+ }
13934
+ template <class T>
13935
+ vector<T> GetOptionList(string name) {
13936
+ if (options.find(name) == options.end()) {
13937
+ throw InternalException("This option does not exist");
13938
+ }
13939
+ auto option = options[name];
13940
+ if (option.type().id() != LogicalTypeId::LIST) {
13941
+ throw InternalException("This option is not a list");
13942
+ }
13943
+ vector<T> result;
13944
+ auto list_children = ListValue::GetChildren(option);
13945
+ for (auto &child : list_children) {
13946
+ result.emplace_back(child.GetValue<T>());
13947
+ }
13948
+ return result;
13949
+ }
13950
+ };
13951
+
13914
13952
  typedef unique_ptr<FunctionData> (*table_function_bind_t)(ClientContext &context, TableFunctionBindInput &input,
13915
13953
  vector<LogicalType> &return_types, vector<string> &names);
13916
13954
  typedef unique_ptr<GlobalTableFunctionState> (*table_function_init_global_t)(ClientContext &context,
@@ -13929,6 +13967,9 @@ typedef OperatorFinalizeResultType (*table_in_out_function_final_t)(ExecutionCon
13929
13967
  typedef idx_t (*table_function_get_batch_index_t)(ClientContext &context, const FunctionData *bind_data,
13930
13968
  LocalTableFunctionState *local_state,
13931
13969
  GlobalTableFunctionState *global_state);
13970
+
13971
+ typedef BindInfo (*table_function_get_bind_info)(const FunctionData *bind_data);
13972
+
13932
13973
  typedef double (*table_function_progress_t)(ClientContext &context, const FunctionData *bind_data,
13933
13974
  const GlobalTableFunctionState *global_state);
13934
13975
  typedef void (*table_function_dependency_t)(unordered_set<CatalogEntry *> &dependencies, const FunctionData *bind_data);
@@ -13992,6 +14033,8 @@ public:
13992
14033
  table_function_progress_t table_scan_progress;
13993
14034
  //! (Optional) returns the current batch index of the current scan operator
13994
14035
  table_function_get_batch_index_t get_batch_index;
14036
+ //! (Optional) returns the extra batch info, currently only used for the substrait extension
14037
+ table_function_get_bind_info get_batch_info;
13995
14038
 
13996
14039
  table_function_serialize_t serialize;
13997
14040
  table_function_deserialize_t deserialize;
@@ -16641,6 +16684,9 @@ public:
16641
16684
  //! Reads CSV file
16642
16685
  DUCKDB_API shared_ptr<Relation> ReadCSV(const string &csv_file);
16643
16686
  DUCKDB_API shared_ptr<Relation> ReadCSV(const string &csv_file, const vector<string> &columns);
16687
+
16688
+ //! Reads Parquet file
16689
+ DUCKDB_API shared_ptr<Relation> ReadParquet(const string &parquet_file, bool binary_as_string);
16644
16690
  //! Returns a relation from a query
16645
16691
  DUCKDB_API shared_ptr<Relation> RelationFromQuery(const string &query, const string &alias = "queryrelation",
16646
16692
  const string &error = "Expected a single SELECT statement");