duckdb 0.3.3-dev1409.0 → 0.3.3-dev1422.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.3-dev1409.0",
4
+ "version": "0.3.3-dev1422.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -57094,7 +57094,7 @@ string PhysicalComparisonJoin::ParamsToString() const {
57094
57094
  string extra_info = JoinTypeToString(join_type) + "\n";
57095
57095
  for (auto &it : conditions) {
57096
57096
  string op = ExpressionTypeToOperator(it.comparison);
57097
- extra_info += it.left->GetName() + op + it.right->GetName() + "\n";
57097
+ extra_info += it.left->GetName() + " " + op + " " + it.right->GetName() + "\n";
57098
57098
  }
57099
57099
  return extra_info;
57100
57100
  }
@@ -91252,14 +91252,11 @@ struct NextSequenceValueOperator {
91252
91252
  bool overflow = !TryAddOperator::Operation(seq->counter, seq->increment, seq->counter);
91253
91253
  if (seq->cycle) {
91254
91254
  if (overflow) {
91255
- throw SequenceException("overflow in sequence");
91256
- }
91257
- if (result < seq->min_value) {
91258
- result = seq->max_value;
91259
- seq->counter = seq->max_value + seq->increment;
91260
- } else if (result > seq->max_value) {
91261
- result = seq->min_value;
91262
- seq->counter = seq->min_value + seq->increment;
91255
+ seq->counter = seq->increment < 0 ? seq->max_value : seq->min_value;
91256
+ } else if (seq->counter < seq->min_value) {
91257
+ seq->counter = seq->max_value;
91258
+ } else if (seq->counter > seq->max_value) {
91259
+ seq->counter = seq->min_value;
91263
91260
  }
91264
91261
  } else {
91265
91262
  if (result < seq->min_value || (overflow && seq->increment < 0)) {
@@ -130650,11 +130647,17 @@ unique_ptr<NodeStatistics> StatisticsPropagator::PropagateStatistics(LogicalJoin
130650
130647
  }
130651
130648
 
130652
130649
  auto join_type = join.join_type;
130650
+ // depending on the join type, we might need to alter the statistics
130651
+ // LEFT, FULL, RIGHT OUTER and SINGLE joins can introduce null values
130652
+ // this requires us to alter the statistics after this point in the query plan
130653
+ bool adds_null_on_left = IsRightOuterJoin(join_type);
130654
+ bool adds_null_on_right = IsLeftOuterJoin(join_type) || join_type == JoinType::SINGLE;
130655
+
130653
130656
  vector<ColumnBinding> left_bindings, right_bindings;
130654
- if (IsRightOuterJoin(join_type)) {
130657
+ if (adds_null_on_left) {
130655
130658
  left_bindings = join.children[0]->GetColumnBindings();
130656
130659
  }
130657
- if (IsLeftOuterJoin(join_type)) {
130660
+ if (adds_null_on_right) {
130658
130661
  right_bindings = join.children[1]->GetColumnBindings();
130659
130662
  }
130660
130663
 
@@ -130670,10 +130673,7 @@ unique_ptr<NodeStatistics> StatisticsPropagator::PropagateStatistics(LogicalJoin
130670
130673
  break;
130671
130674
  }
130672
130675
 
130673
- // now depending on the join type, we might need to alter the statistics
130674
- // LEFT, FULL and RIGHT OUTER joins can introduce null values
130675
- // this requires us to alter the statistics after this point in the query plan
130676
- if (IsLeftOuterJoin(join_type)) {
130676
+ if (adds_null_on_right) {
130677
130677
  // left or full outer join: set IsNull() to true for all rhs statistics
130678
130678
  for (auto &binding : right_bindings) {
130679
130679
  auto stats = statistics_map.find(binding);
@@ -130682,7 +130682,7 @@ unique_ptr<NodeStatistics> StatisticsPropagator::PropagateStatistics(LogicalJoin
130682
130682
  }
130683
130683
  }
130684
130684
  }
130685
- if (IsRightOuterJoin(join_type)) {
130685
+ if (adds_null_on_left) {
130686
130686
  // right or full outer join: set IsNull() to true for all lhs statistics
130687
130687
  for (auto &binding : left_bindings) {
130688
130688
  auto stats = statistics_map.find(binding);
@@ -132114,6 +132114,9 @@ bool Pipeline::GetProgressInternal(ClientContext &context, PhysicalOperator *op,
132114
132114
  if (!GetProgressInternal(context, op_child.get(), child_percentage)) {
132115
132115
  return false;
132116
132116
  }
132117
+ if (!Value::DoubleIsFinite(child_percentage)) {
132118
+ return false;
132119
+ }
132117
132120
  progress.push_back(child_percentage);
132118
132121
  cardinality.push_back(op_child->estimated_cardinality);
132119
132122
  total_cardinality += op_child->estimated_cardinality;
@@ -152654,7 +152657,7 @@ unique_ptr<ParsedExpression> ExpressionBinder::CreateStructExtract(unique_ptr<Pa
152654
152657
  vector<unique_ptr<ParsedExpression>> children;
152655
152658
  children.push_back(move(base));
152656
152659
  children.push_back(make_unique_base<ParsedExpression, ConstantExpression>(Value(move(field_name))));
152657
- auto extract_fun = make_unique<FunctionExpression>("struct_extract", move(children));
152660
+ auto extract_fun = make_unique<OperatorExpression>(ExpressionType::STRUCT_EXTRACT, move(children));
152658
152661
  return move(extract_fun);
152659
152662
  }
152660
152663
 
@@ -153010,12 +153013,13 @@ BindResult ExpressionBinder::BindFunction(FunctionExpression &function, ScalarFu
153010
153013
  vector<unique_ptr<Expression>> children;
153011
153014
  for (idx_t i = 0; i < function.children.size(); i++) {
153012
153015
  auto &child = (BoundExpression &)*function.children[i];
153016
+ D_ASSERT(child.expr);
153013
153017
  children.push_back(move(child.expr));
153014
153018
  }
153015
153019
  unique_ptr<Expression> result =
153016
153020
  ScalarFunction::BindScalarFunction(context, *func, move(children), error, function.is_operator);
153017
153021
  if (!result) {
153018
- return BindResult(binder.FormatError(function, error));
153022
+ throw BinderException(binder.FormatError(function, error));
153019
153023
  }
153020
153024
  return BindResult(move(result));
153021
153025
  }
@@ -153252,9 +153256,21 @@ BindResult ExpressionBinder::BindExpression(OperatorExpression &op, idx_t depth)
153252
153256
  case ExpressionType::ARRAY_SLICE:
153253
153257
  function_name = "array_slice";
153254
153258
  break;
153255
- case ExpressionType::STRUCT_EXTRACT:
153259
+ case ExpressionType::STRUCT_EXTRACT: {
153260
+ D_ASSERT(op.children.size() == 2);
153261
+ D_ASSERT(op.children[0]->expression_class == ExpressionClass::BOUND_EXPRESSION);
153262
+ D_ASSERT(op.children[1]->expression_class == ExpressionClass::BOUND_EXPRESSION);
153263
+ auto &extract_exp = (BoundExpression &)*op.children[0];
153264
+ auto &name_exp = (BoundExpression &)*op.children[1];
153265
+ if (extract_exp.expr->return_type.id() != LogicalTypeId::STRUCT &&
153266
+ extract_exp.expr->return_type.id() != LogicalTypeId::SQLNULL) {
153267
+ return BindResult(
153268
+ StringUtil::Format("Cannot extract field %s from expression \"%s\" because it is not a struct",
153269
+ name_exp.ToString(), extract_exp.ToString()));
153270
+ }
153256
153271
  function_name = "struct_extract";
153257
153272
  break;
153273
+ }
153258
153274
  case ExpressionType::ARRAY_CONSTRUCTOR:
153259
153275
  function_name = "list_value";
153260
153276
  break;
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 "6ac91ddc1"
15
- #define DUCKDB_VERSION "v0.3.3-dev1409"
14
+ #define DUCKDB_SOURCE_ID "f3371d736"
15
+ #define DUCKDB_VERSION "v0.3.3-dev1422"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //