duckdb 0.3.3-dev1409.0 → 0.3.3-dev1418.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-dev1418.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
  }
@@ -130650,11 +130650,17 @@ unique_ptr<NodeStatistics> StatisticsPropagator::PropagateStatistics(LogicalJoin
130650
130650
  }
130651
130651
 
130652
130652
  auto join_type = join.join_type;
130653
+ // depending on the join type, we might need to alter the statistics
130654
+ // LEFT, FULL, RIGHT OUTER and SINGLE joins can introduce null values
130655
+ // this requires us to alter the statistics after this point in the query plan
130656
+ bool adds_null_on_left = IsRightOuterJoin(join_type);
130657
+ bool adds_null_on_right = IsLeftOuterJoin(join_type) || join_type == JoinType::SINGLE;
130658
+
130653
130659
  vector<ColumnBinding> left_bindings, right_bindings;
130654
- if (IsRightOuterJoin(join_type)) {
130660
+ if (adds_null_on_left) {
130655
130661
  left_bindings = join.children[0]->GetColumnBindings();
130656
130662
  }
130657
- if (IsLeftOuterJoin(join_type)) {
130663
+ if (adds_null_on_right) {
130658
130664
  right_bindings = join.children[1]->GetColumnBindings();
130659
130665
  }
130660
130666
 
@@ -130670,10 +130676,7 @@ unique_ptr<NodeStatistics> StatisticsPropagator::PropagateStatistics(LogicalJoin
130670
130676
  break;
130671
130677
  }
130672
130678
 
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)) {
130679
+ if (adds_null_on_right) {
130677
130680
  // left or full outer join: set IsNull() to true for all rhs statistics
130678
130681
  for (auto &binding : right_bindings) {
130679
130682
  auto stats = statistics_map.find(binding);
@@ -130682,7 +130685,7 @@ unique_ptr<NodeStatistics> StatisticsPropagator::PropagateStatistics(LogicalJoin
130682
130685
  }
130683
130686
  }
130684
130687
  }
130685
- if (IsRightOuterJoin(join_type)) {
130688
+ if (adds_null_on_left) {
130686
130689
  // right or full outer join: set IsNull() to true for all lhs statistics
130687
130690
  for (auto &binding : left_bindings) {
130688
130691
  auto stats = statistics_map.find(binding);
@@ -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 "a5b6279ed"
15
+ #define DUCKDB_VERSION "v0.3.3-dev1418"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //