duckdb 0.5.2-dev52.0 → 0.5.2-dev58.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-dev52.0",
4
+ "version": "0.5.2-dev58.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -82798,7 +82798,7 @@ public:
82798
82798
  protected:
82799
82799
  vector<ColumnBinding> GetColumnBindings() override {
82800
82800
  if (return_chunk) {
82801
- return GenerateColumnBindings(table_index, table->columns.size());
82801
+ return GenerateColumnBindings(table_index, table->GetTypes().size());
82802
82802
  }
82803
82803
  return {ColumnBinding(0, 0)};
82804
82804
  }
@@ -84174,7 +84174,7 @@ public:
84174
84174
  protected:
84175
84175
  vector<ColumnBinding> GetColumnBindings() override {
84176
84176
  if (return_chunk) {
84177
- return GenerateColumnBindings(table_index, table->columns.size());
84177
+ return GenerateColumnBindings(table_index, table->GetTypes().size());
84178
84178
  }
84179
84179
  return {ColumnBinding(0, 0)};
84180
84180
  }
@@ -85226,7 +85226,7 @@ public:
85226
85226
  protected:
85227
85227
  vector<ColumnBinding> GetColumnBindings() override {
85228
85228
  if (return_chunk) {
85229
- return GenerateColumnBindings(table_index, table->columns.size());
85229
+ return GenerateColumnBindings(table_index, table->GetTypes().size());
85230
85230
  }
85231
85231
  return {ColumnBinding(0, 0)};
85232
85232
  }
@@ -174848,7 +174848,9 @@ unique_ptr<ParsedExpression> BindContext::ExpandGeneratedColumn(const string &ta
174848
174848
  auto binding = GetBinding(table_name, error_message);
174849
174849
  D_ASSERT(binding);
174850
174850
  auto &table_binding = *(TableBinding *)binding;
174851
- return table_binding.ExpandGeneratedColumn(column_name);
174851
+ auto result = table_binding.ExpandGeneratedColumn(column_name);
174852
+ result->alias = column_name;
174853
+ return result;
174852
174854
  }
174853
174855
 
174854
174856
  unique_ptr<ParsedExpression> BindContext::CreateColumnReference(const string &table_name, const string &column_name) {
@@ -175100,13 +175102,15 @@ void BindContext::AddBinding(const string &alias, unique_ptr<Binding> binding) {
175100
175102
  }
175101
175103
 
175102
175104
  void BindContext::AddBaseTable(idx_t index, const string &alias, const vector<string> &names,
175103
- const vector<LogicalType> &types, LogicalGet &get) {
175104
- AddBinding(alias, make_unique<TableBinding>(alias, types, names, get, index, true));
175105
+ const vector<LogicalType> &types, vector<column_t> &bound_column_ids,
175106
+ StandardEntry *entry) {
175107
+ AddBinding(alias, make_unique<TableBinding>(alias, types, names, bound_column_ids, entry, index, true));
175105
175108
  }
175106
175109
 
175107
175110
  void BindContext::AddTableFunction(idx_t index, const string &alias, const vector<string> &names,
175108
- const vector<LogicalType> &types, LogicalGet &get) {
175109
- AddBinding(alias, make_unique<TableBinding>(alias, types, names, get, index));
175111
+ const vector<LogicalType> &types, vector<column_t> &bound_column_ids,
175112
+ StandardEntry *entry) {
175113
+ AddBinding(alias, make_unique<TableBinding>(alias, types, names, bound_column_ids, entry, index));
175110
175114
  }
175111
175115
 
175112
175116
  static string AddColumnNameToBinding(const string &base_name, case_insensitive_set_t &current_names) {
@@ -176030,7 +176034,12 @@ BindResult ExpressionBinder::BindExpression(ColumnRefExpression &colref_p, idx_t
176030
176034
  }
176031
176035
  //! Generated column returns generated expression
176032
176036
  if (expr->type != ExpressionType::COLUMN_REF) {
176033
- return BindExpression(&expr, depth);
176037
+ auto alias = expr->alias;
176038
+ auto result = BindExpression(&expr, depth);
176039
+ if (result.expression) {
176040
+ result.expression->alias = move(alias);
176041
+ }
176042
+ return result;
176034
176043
  }
176035
176044
  auto &colref = (ColumnRefExpression &)*expr;
176036
176045
  D_ASSERT(colref.IsQualified());
@@ -178876,6 +178885,10 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSetOperationNode &node) {
178876
178885
 
178877
178886
 
178878
178887
 
178888
+
178889
+
178890
+
178891
+
178879
178892
  //===----------------------------------------------------------------------===//
178880
178893
  // DuckDB
178881
178894
  //
@@ -178927,10 +178940,6 @@ private:
178927
178940
  } // namespace duckdb
178928
178941
 
178929
178942
 
178930
-
178931
-
178932
-
178933
-
178934
178943
  namespace duckdb {
178935
178944
 
178936
178945
  static unique_ptr<Expression> PlanUncorrelatedSubquery(Binder &binder, BoundSubqueryExpression &expr,
@@ -179182,7 +179191,7 @@ static unique_ptr<Expression> PlanCorrelatedSubquery(Binder &binder, BoundSubque
179182
179191
  auto delim_join = CreateDuplicateEliminatedJoin(correlated_columns, JoinType::MARK, move(root), perform_delim);
179183
179192
  delim_join->mark_index = mark_index;
179184
179193
  // RHS
179185
- FlattenDependentJoins flatten(binder, correlated_columns, perform_delim);
179194
+ FlattenDependentJoins flatten(binder, correlated_columns, perform_delim, true);
179186
179195
  flatten.DetectCorrelatedExpressions(plan.get());
179187
179196
  auto dependent_join = flatten.PushDownDependentJoin(move(plan));
179188
179197
 
@@ -179209,7 +179218,7 @@ static unique_ptr<Expression> PlanCorrelatedSubquery(Binder &binder, BoundSubque
179209
179218
  auto delim_join = CreateDuplicateEliminatedJoin(correlated_columns, JoinType::MARK, move(root), perform_delim);
179210
179219
  delim_join->mark_index = mark_index;
179211
179220
  // RHS
179212
- FlattenDependentJoins flatten(binder, correlated_columns, true);
179221
+ FlattenDependentJoins flatten(binder, correlated_columns, true, true);
179213
179222
  flatten.DetectCorrelatedExpressions(plan.get());
179214
179223
  auto dependent_join = flatten.PushDownDependentJoin(move(plan));
179215
179224
 
@@ -182036,7 +182045,8 @@ unique_ptr<BoundTableRef> Binder::Bind(BaseTableRef &ref) {
182036
182045
 
182037
182046
  auto logical_get = make_unique<LogicalGet>(table_index, scan_function, move(bind_data), move(return_types),
182038
182047
  move(return_names));
182039
- bind_context.AddBaseTable(table_index, alias, table_names, table_types, *logical_get);
182048
+ bind_context.AddBaseTable(table_index, alias, table_names, table_types, logical_get->column_ids,
182049
+ logical_get->GetTable());
182040
182050
  return make_unique_base<BoundTableRef, BoundBaseTableRef>(table, move(logical_get));
182041
182051
  }
182042
182052
  case CatalogType::VIEW_ENTRY: {
@@ -182709,7 +182719,8 @@ Binder::BindTableFunctionInternal(TableFunction &table_function, const string &f
182709
182719
  get->input_table_types = input_table_types;
182710
182720
  get->input_table_names = input_table_names;
182711
182721
  // now add the table function to the bind context so its columns can be bound
182712
- bind_context.AddTableFunction(bind_index, function_name, return_names, return_types, *get);
182722
+ bind_context.AddTableFunction(bind_index, function_name, return_names, return_types, get->column_ids,
182723
+ get->GetTable());
182713
182724
  return move(get);
182714
182725
  }
182715
182726
 
@@ -183550,12 +183561,18 @@ BoundStatement Binder::BindReturning(vector<unique_ptr<ParsedExpression>> return
183550
183561
 
183551
183562
  auto binder = Binder::CreateBinder(context);
183552
183563
 
183564
+ vector<column_t> bound_columns;
183565
+ idx_t column_count = 0;
183553
183566
  for (auto &col : table->columns) {
183554
183567
  names.push_back(col.Name());
183555
183568
  types.push_back(col.Type());
183569
+ if (!col.Generated()) {
183570
+ bound_columns.push_back(column_count);
183571
+ }
183572
+ column_count++;
183556
183573
  }
183557
183574
 
183558
- binder->bind_context.AddGenericBinding(update_table_index, table->name, names, types);
183575
+ binder->bind_context.AddBaseTable(update_table_index, table->name, names, types, bound_columns, table);
183559
183576
  ReturningBinder returning_binder(*binder, context);
183560
183577
 
183561
183578
  vector<unique_ptr<Expression>> projection_expressions;
@@ -189995,7 +190012,6 @@ unique_ptr<Expression> RewriteCountAggregates::VisitReplace(BoundColumnRefExpres
189995
190012
 
189996
190013
 
189997
190014
 
189998
-
189999
190015
  namespace duckdb {
190000
190016
 
190001
190017
  Binding::Binding(BindingType binding_type, const string &alias, vector<LogicalType> coltypes, vector<string> colnames,
@@ -190069,9 +190085,10 @@ StandardEntry *EntryBinding::GetStandardEntry() {
190069
190085
  return &this->entry;
190070
190086
  }
190071
190087
 
190072
- TableBinding::TableBinding(const string &alias, vector<LogicalType> types_p, vector<string> names_p, LogicalGet &get,
190073
- idx_t index, bool add_row_id)
190074
- : Binding(BindingType::TABLE, alias, move(types_p), move(names_p), index), get(get) {
190088
+ TableBinding::TableBinding(const string &alias, vector<LogicalType> types_p, vector<string> names_p,
190089
+ vector<column_t> &bound_column_ids, StandardEntry *entry, idx_t index, bool add_row_id)
190090
+ : Binding(BindingType::TABLE, alias, move(types_p), move(names_p), index), bound_column_ids(bound_column_ids),
190091
+ entry(entry) {
190075
190092
  if (add_row_id) {
190076
190093
  if (name_map.find("rowid") == name_map.end()) {
190077
190094
  name_map["rowid"] = COLUMN_IDENTIFIER_ROW_ID;
@@ -190138,7 +190155,7 @@ BindResult TableBinding::Bind(ColumnRefExpression &colref, idx_t depth) {
190138
190155
  }
190139
190156
  }
190140
190157
 
190141
- auto &column_ids = get.column_ids;
190158
+ auto &column_ids = bound_column_ids;
190142
190159
  // check if the entry already exists in the column list for the table
190143
190160
  ColumnBinding binding;
190144
190161
 
@@ -190158,7 +190175,7 @@ BindResult TableBinding::Bind(ColumnRefExpression &colref, idx_t depth) {
190158
190175
  }
190159
190176
 
190160
190177
  StandardEntry *TableBinding::GetStandardEntry() {
190161
- return get.GetTable();
190178
+ return entry;
190162
190179
  }
190163
190180
 
190164
190181
  string TableBinding::ColumnNotFoundError(const string &column_name) const {
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 "8e8098572"
15
- #define DUCKDB_VERSION "v0.5.2-dev52"
14
+ #define DUCKDB_SOURCE_ID "832a84d50"
15
+ #define DUCKDB_VERSION "v0.5.2-dev58"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -16080,11 +16080,13 @@ public:
16080
16080
  //! TableBinding is exactly like the Binding, except it keeps track of which columns were bound in the linked LogicalGet
16081
16081
  //! node for projection pushdown purposes.
16082
16082
  struct TableBinding : public Binding {
16083
- TableBinding(const string &alias, vector<LogicalType> types, vector<string> names, LogicalGet &get, idx_t index,
16084
- bool add_row_id = false);
16083
+ TableBinding(const string &alias, vector<LogicalType> types, vector<string> names,
16084
+ vector<column_t> &bound_column_ids, StandardEntry *entry, idx_t index, bool add_row_id = false);
16085
16085
 
16086
- //! the underlying LogicalGet
16087
- LogicalGet &get;
16086
+ //! A reference to the set of bound column ids
16087
+ vector<column_t> &bound_column_ids;
16088
+ //! The underlying catalog entry (if any)
16089
+ StandardEntry *entry;
16088
16090
 
16089
16091
  public:
16090
16092
  unique_ptr<ParsedExpression> ExpandGeneratedColumn(const string &column_name);
@@ -16176,10 +16178,10 @@ public:
16176
16178
 
16177
16179
  //! Adds a base table with the given alias to the BindContext.
16178
16180
  void AddBaseTable(idx_t index, const string &alias, const vector<string> &names, const vector<LogicalType> &types,
16179
- LogicalGet &get);
16181
+ vector<column_t> &bound_column_ids, StandardEntry *entry);
16180
16182
  //! Adds a call to a table function with the given alias to the BindContext.
16181
16183
  void AddTableFunction(idx_t index, const string &alias, const vector<string> &names,
16182
- const vector<LogicalType> &types, LogicalGet &get);
16184
+ const vector<LogicalType> &types, vector<column_t> &bound_column_ids, StandardEntry *entry);
16183
16185
  //! Adds a table view with a given alias to the BindContext.
16184
16186
  void AddView(idx_t index, const string &alias, SubqueryRef &ref, BoundQueryNode &subquery, ViewCatalogEntry *view);
16185
16187
  //! Adds a subquery with a given alias to the BindContext.