duckdb 0.8.2-dev4474.0 → 0.8.2-dev4514.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.8.2-dev4474.0",
5
+ "version": "0.8.2-dev4514.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -244,6 +244,9 @@ struct ExecuteSqlTableFunction {
244
244
  auto result = make_uniq<BindData>();
245
245
 
246
246
  result->con = make_uniq<Connection>(*context.db);
247
+ if (input.inputs[0].IsNull()) {
248
+ throw BinderException("json_execute_serialized_sql cannot execute NULL plan");
249
+ }
247
250
  auto serialized = input.inputs[0].GetValueUnsafe<string>();
248
251
  auto stmt = DeserializeSelectStatement(serialized, alc);
249
252
  result->plan = result->con->RelationFromQuery(std::move(stmt));
@@ -102,6 +102,7 @@ void ColumnBindingResolver::VisitOperator(LogicalOperator &op) {
102
102
  default:
103
103
  break;
104
104
  }
105
+
105
106
  // general case
106
107
  // first visit the children of this operator
107
108
  VisitOperatorChildren(op);
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.8.2-dev4474"
2
+ #define DUCKDB_VERSION "0.8.2-dev4514"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "ba71015ee7"
5
+ #define DUCKDB_SOURCE_ID "38c6e8ccce"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"
@@ -13,7 +13,7 @@
13
13
  namespace duckdb {
14
14
 
15
15
  // The Empty_needle_removal Optimization rule folds some foldable ConstantExpression
16
- //(e.g.: PREFIX('xyz', '') is TRUE, PREFIX(NULL, '') is NULL, so rewrite PREFIX(x, '') to (CASE WHEN x IS NOT NULL THEN)
16
+ //(e.g.: PREFIX('xyz', '') is TRUE, PREFIX(NULL, '') is NULL, so rewrite PREFIX(x, '') to TRUE_OR_NULL(x)
17
17
  class EmptyNeedleRemovalRule : public Rule {
18
18
  public:
19
19
  explicit EmptyNeedleRemovalRule(ExpressionRewriter &rewriter);
@@ -72,17 +72,21 @@ void ColumnLifetimeAnalyzer::VisitOperator(LogicalOperator &op) {
72
72
  for (auto &cond : comp_join.conditions) {
73
73
  if (cond.comparison == ExpressionType::COMPARE_EQUAL) {
74
74
  has_equality = true;
75
+ break;
75
76
  }
76
77
  }
77
78
  if (!has_equality) {
78
79
  break;
79
80
  }
80
- // now, for each of the columns of the RHS, check which columns need to be projected
81
+ // visit current operator expressions so they are added to the referenced_columns
82
+ LogicalOperatorVisitor::VisitOperatorExpressions(op);
83
+
81
84
  column_binding_set_t unused_bindings;
85
+ auto old_op_bindings = op.GetColumnBindings();
82
86
  ExtractUnusedColumnBindings(op.children[1]->GetColumnBindings(), unused_bindings);
83
87
 
84
88
  // now recurse into the filter and its children
85
- StandardVisitOperator(op);
89
+ LogicalOperatorVisitor::VisitOperatorChildren(op);
86
90
 
87
91
  // then generate the projection map
88
92
  GenerateProjectionMap(op.children[1]->GetColumnBindings(), unused_bindings, comp_join.right_projection_map);
@@ -118,12 +122,14 @@ void ColumnLifetimeAnalyzer::VisitOperator(LogicalOperator &op) {
118
122
  if (everything_referenced) {
119
123
  break;
120
124
  }
125
+ // first visit operator expressions to populate referenced columns
126
+ LogicalOperatorVisitor::VisitOperatorExpressions(op);
121
127
  // filter, figure out which columns are not needed after the filter
122
128
  column_binding_set_t unused_bindings;
123
129
  ExtractUnusedColumnBindings(op.children[0]->GetColumnBindings(), unused_bindings);
124
130
 
125
131
  // now recurse into the filter and its children
126
- StandardVisitOperator(op);
132
+ LogicalOperatorVisitor::VisitOperatorChildren(op);
127
133
 
128
134
  // then generate the projection map
129
135
  GenerateProjectionMap(op.children[0]->GetColumnBindings(), unused_bindings, filter.projection_map);
@@ -11,7 +11,6 @@ unique_ptr<NodeStatistics> StatisticsPropagator::PropagateStatistics(LogicalProj
11
11
  ReplaceWithEmptyResult(*node_ptr);
12
12
  return std::move(node_stats);
13
13
  }
14
-
15
14
  // then propagate to each of the expressions
16
15
  for (idx_t i = 0; i < proj.expressions.size(); i++) {
17
16
  auto stats = PropagateExpression(proj.expressions[i]);