duckdb 0.5.1-dev5.0 → 0.5.1-dev50.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.1-dev5.0",
4
+ "version": "0.5.1-dev50.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -33336,6 +33336,9 @@ void RowOperations::UnswizzleHeapPointer(const RowLayout &layout, const data_ptr
33336
33336
 
33337
33337
  static inline void VerifyUnswizzledString(const RowLayout &layout, const idx_t &col_idx, const data_ptr_t &row_ptr) {
33338
33338
  #ifdef DEBUG
33339
+ if (layout.GetTypes()[col_idx] == LogicalTypeId::BLOB) {
33340
+ return;
33341
+ }
33339
33342
  idx_t entry_idx;
33340
33343
  idx_t idx_in_entry;
33341
33344
  ValidityBytes::GetEntryIndex(col_idx, entry_idx, idx_in_entry);
@@ -96859,7 +96862,8 @@ struct DateDiff {
96859
96862
  struct WeekOperator {
96860
96863
  template <class TA, class TB, class TR>
96861
96864
  static inline TR Operation(TA startdate, TB enddate) {
96862
- return Date::Epoch(enddate) / Interval::SECS_PER_WEEK - Date::Epoch(startdate) / Interval::SECS_PER_WEEK;
96865
+ return Date::Epoch(Date::GetMondayOfCurrentWeek(enddate)) / Interval::SECS_PER_WEEK -
96866
+ Date::Epoch(Date::GetMondayOfCurrentWeek(startdate)) / Interval::SECS_PER_WEEK;
96863
96867
  }
96864
96868
  };
96865
96869
 
@@ -141402,7 +141406,7 @@ Value ForceCompressionSetting::GetSetting(ClientContext &context) {
141402
141406
  //===--------------------------------------------------------------------===//
141403
141407
  void HomeDirectorySetting::SetLocal(ClientContext &context, const Value &input) {
141404
141408
  auto &config = ClientConfig::GetConfig(context);
141405
- config.home_directory = input.IsNull() ? input.ToString() : string();
141409
+ config.home_directory = input.IsNull() ? string() : input.ToString();
141406
141410
  }
141407
141411
 
141408
141412
  Value HomeDirectorySetting::GetSetting(ClientContext &context) {
@@ -151925,6 +151929,7 @@ unique_ptr<NodeStatistics> StatisticsPropagator::PropagateStatistics(LogicalGet
151925
151929
 
151926
151930
 
151927
151931
 
151932
+
151928
151933
  namespace duckdb {
151929
151934
 
151930
151935
  void StatisticsPropagator::PropagateStatistics(LogicalComparisonJoin &join, unique_ptr<LogicalOperator> *node_ptr) {
@@ -151954,10 +151959,15 @@ void StatisticsPropagator::PropagateStatistics(LogicalComparisonJoin &join, uniq
151954
151959
  // semi or inner join on false; entire node can be pruned
151955
151960
  ReplaceWithEmptyResult(*node_ptr);
151956
151961
  return;
151957
- case JoinType::ANTI:
151958
- // anti join: replace entire join with LHS
151959
- *node_ptr = move(join.children[0]);
151962
+ case JoinType::ANTI: {
151963
+ // when the right child has data, return the left child
151964
+ // when the right child has no data, return an empty set
151965
+ auto limit = make_unique<LogicalLimit>(1, 0, nullptr, nullptr);
151966
+ limit->AddChild(move(join.children[1]));
151967
+ auto cross_product = LogicalCrossProduct::Create(move(join.children[0]), move(limit));
151968
+ *node_ptr = move(cross_product);
151960
151969
  return;
151970
+ }
151961
151971
  case JoinType::LEFT:
151962
151972
  // anti/left outer join: replace right side with empty node
151963
151973
  ReplaceWithEmptyResult(join.children[1]);
@@ -151985,10 +151995,15 @@ void StatisticsPropagator::PropagateStatistics(LogicalComparisonJoin &join, uniq
151985
151995
  } else {
151986
151996
  // this is the only condition and it is always true: all conditions are true
151987
151997
  switch (join.join_type) {
151988
- case JoinType::SEMI:
151989
- // semi join on true: replace entire join with LHS
151990
- *node_ptr = move(join.children[0]);
151998
+ case JoinType::SEMI: {
151999
+ // when the right child has data, return the left child
152000
+ // when the right child has no data, return an empty set
152001
+ auto limit = make_unique<LogicalLimit>(1, 0, nullptr, nullptr);
152002
+ limit->AddChild(move(join.children[1]));
152003
+ auto cross_product = LogicalCrossProduct::Create(move(join.children[0]), move(limit));
152004
+ *node_ptr = move(cross_product);
151991
152005
  return;
152006
+ }
151992
152007
  case JoinType::INNER:
151993
152008
  case JoinType::LEFT:
151994
152009
  case JoinType::RIGHT:
@@ -152105,6 +152120,7 @@ unique_ptr<NodeStatistics> StatisticsPropagator::PropagateStatistics(LogicalJoin
152105
152120
  // then propagate into the join conditions
152106
152121
  switch (join.type) {
152107
152122
  case LogicalOperatorType::LOGICAL_COMPARISON_JOIN:
152123
+ case LogicalOperatorType::LOGICAL_DELIM_JOIN:
152108
152124
  PropagateStatistics((LogicalComparisonJoin &)join, node_ptr);
152109
152125
  break;
152110
152126
  case LogicalOperatorType::LOGICAL_ANY_JOIN:
@@ -171765,7 +171781,7 @@ LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName *type_n
171765
171781
 
171766
171782
  result_type = LogicalType::MAP(move(children));
171767
171783
  } else {
171768
- int8_t width, scale;
171784
+ int64_t width, scale;
171769
171785
  if (base_type == LogicalTypeId::DECIMAL) {
171770
171786
  // default decimal width/scale
171771
171787
  width = 18;
@@ -180863,6 +180879,9 @@ BoundStatement Binder::BindSummarize(ShowStatement &stmt) {
180863
180879
 
180864
180880
 
180865
180881
 
180882
+
180883
+
180884
+
180866
180885
  //===----------------------------------------------------------------------===//
180867
180886
  // DuckDB
180868
180887
  //
@@ -180897,10 +180916,6 @@ protected:
180897
180916
 
180898
180917
 
180899
180918
 
180900
-
180901
-
180902
-
180903
-
180904
180919
  //===----------------------------------------------------------------------===//
180905
180920
  // DuckDB
180906
180921
  //
@@ -180933,6 +180948,8 @@ public:
180933
180948
  };
180934
180949
  } // namespace duckdb
180935
180950
 
180951
+
180952
+
180936
180953
  #include <algorithm>
180937
180954
 
180938
180955
  namespace duckdb {
@@ -181103,10 +181120,10 @@ BoundStatement Binder::Bind(UpdateStatement &stmt) {
181103
181120
  if (column.Generated()) {
181104
181121
  throw BinderException("Cant update column \"%s\" because it is a generated column!", column.Name());
181105
181122
  }
181106
- if (std::find(update->columns.begin(), update->columns.end(), column.Oid()) != update->columns.end()) {
181123
+ if (std::find(update->columns.begin(), update->columns.end(), column.StorageOid()) != update->columns.end()) {
181107
181124
  throw BinderException("Multiple assignments to same column \"%s\"", colname);
181108
181125
  }
181109
- update->columns.push_back(column.Oid());
181126
+ update->columns.push_back(column.StorageOid());
181110
181127
 
181111
181128
  if (expr->type == ExpressionType::VALUE_DEFAULT) {
181112
181129
  update->expressions.push_back(make_unique<BoundDefaultExpression>(column.Type()));
@@ -181188,7 +181205,20 @@ BoundStatement Binder::Bind(VacuumStatement &stmt) {
181188
181205
  auto &get = (LogicalGet &)*ref->get;
181189
181206
  columns.insert(columns.end(), get.names.begin(), get.names.end());
181190
181207
  }
181208
+
181209
+ case_insensitive_set_t column_name_set;
181210
+ vector<string> non_generated_column_names;
181191
181211
  for (auto &col_name : columns) {
181212
+ if (column_name_set.count(col_name) > 0) {
181213
+ throw BinderException("Vacuum the same column twice(same name in column name list)");
181214
+ }
181215
+ column_name_set.insert(col_name);
181216
+ auto &col = ref->table->GetColumn(col_name);
181217
+ // ignore generated column
181218
+ if (col.Generated()) {
181219
+ continue;
181220
+ }
181221
+ non_generated_column_names.push_back(col_name);
181192
181222
  ColumnRefExpression colref(col_name, ref->table->name);
181193
181223
  auto result = bind_context.BindColumn(colref, 0);
181194
181224
  if (result.HasError()) {
@@ -181196,17 +181226,29 @@ BoundStatement Binder::Bind(VacuumStatement &stmt) {
181196
181226
  }
181197
181227
  select_list.push_back(move(result.expression));
181198
181228
  }
181199
- auto table_scan = CreatePlan(*ref);
181200
- D_ASSERT(table_scan->type == LogicalOperatorType::LOGICAL_GET);
181201
- auto &get = (LogicalGet &)*table_scan;
181202
- for (idx_t i = 0; i < get.column_ids.size(); i++) {
181203
- stmt.info->column_id_map[i] = get.column_ids[i];
181204
- }
181229
+ stmt.info->columns = move(non_generated_column_names);
181230
+ if (!select_list.empty()) {
181231
+ auto table_scan = CreatePlan(*ref);
181232
+ D_ASSERT(table_scan->type == LogicalOperatorType::LOGICAL_GET);
181205
181233
 
181206
- auto projection = make_unique<LogicalProjection>(GenerateTableIndex(), move(select_list));
181207
- projection->children.push_back(move(table_scan));
181234
+ auto &get = (LogicalGet &)*table_scan;
181235
+
181236
+ D_ASSERT(select_list.size() == get.column_ids.size());
181237
+ D_ASSERT(stmt.info->columns.size() == get.column_ids.size());
181238
+ for (idx_t i = 0; i < get.column_ids.size(); i++) {
181239
+ stmt.info->column_id_map[i] = ref->table->columns[get.column_ids[i]].StorageOid();
181240
+ }
181208
181241
 
181209
- root = move(projection);
181242
+ auto projection = make_unique<LogicalProjection>(GenerateTableIndex(), move(select_list));
181243
+ projection->children.push_back(move(table_scan));
181244
+
181245
+ root = move(projection);
181246
+ } else {
181247
+ // eg. CREATE TABLE test (x AS (1));
181248
+ // ANALYZE test;
181249
+ // Make it not a SINK so it doesn't have to do anything
181250
+ stmt.info->has_table = false;
181251
+ }
181210
181252
  }
181211
181253
  auto vacuum = make_unique<LogicalSimple>(LogicalOperatorType::LOGICAL_VACUUM, move(stmt.info));
181212
181254
  if (root) {
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 "ba2666673"
15
- #define DUCKDB_VERSION "v0.5.1-dev5"
14
+ #define DUCKDB_SOURCE_ID "70b2c7359"
15
+ #define DUCKDB_VERSION "v0.5.1-dev50"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -3372,8 +3372,8 @@ public:
3372
3372
  DUCKDB_API AllocatedData(Allocator &allocator, data_ptr_t pointer, idx_t allocated_size);
3373
3373
  DUCKDB_API ~AllocatedData();
3374
3374
  // disable copy constructors
3375
- DUCKDB_API AllocatedData(const AllocatedData &other) = delete;
3376
- DUCKDB_API AllocatedData &operator=(const AllocatedData &) = delete;
3375
+ AllocatedData(const AllocatedData &other) = delete;
3376
+ AllocatedData &operator=(const AllocatedData &) = delete;
3377
3377
  //! enable move constructors
3378
3378
  DUCKDB_API AllocatedData(AllocatedData &&other) noexcept;
3379
3379
  DUCKDB_API AllocatedData &operator=(AllocatedData &&) noexcept;
@@ -27469,7 +27469,8 @@ public:
27469
27469
  public:
27470
27470
  template <class T, class BASE>
27471
27471
  static string ToString(const T &entry) {
27472
- return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
27472
+ return StringUtil::Format("(%s) %s (%s)", entry.left->ToString(), ExpressionTypeToOperator(entry.type),
27473
+ entry.right->ToString());
27473
27474
  }
27474
27475
  };
27475
27476
  } // namespace duckdb