duckdb 0.3.2-dev333.0 → 0.3.2-dev337.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.2-dev333.0",
4
+ "version": "0.3.2-dev337.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -49529,7 +49529,9 @@ idx_t GroupedAggregateHashTable::Scan(idx_t &scan_position, DataChunk &result) {
49529
49529
  }
49530
49530
 
49531
49531
  void GroupedAggregateHashTable::Finalize() {
49532
- D_ASSERT(!is_finalized);
49532
+ if (is_finalized) {
49533
+ return;
49534
+ }
49533
49535
 
49534
49536
  // early release hashes, not needed for partition/scan
49535
49537
  hashes_hdl.reset();
@@ -65967,18 +65969,11 @@ public:
65967
65969
  vector<vector<unique_ptr<Expression>>> expressions;
65968
65970
 
65969
65971
  public:
65970
- unique_ptr<GlobalSourceState> GetGlobalSourceState(ClientContext &context) const override;
65971
- void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate,
65972
- LocalSourceState &lstate) const override;
65973
-
65974
- public:
65975
- // Sink interface
65976
- SinkResultType Sink(ExecutionContext &context, GlobalSinkState &gstate, LocalSinkState &lstate,
65977
- DataChunk &input) const override;
65978
-
65979
- unique_ptr<GlobalSinkState> GetGlobalSinkState(ClientContext &context) const override;
65972
+ unique_ptr<OperatorState> GetOperatorState(ClientContext &context) const override;
65973
+ OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk,
65974
+ OperatorState &state) const override;
65980
65975
 
65981
- bool IsSink() const override {
65976
+ bool ParallelOperator() const override {
65982
65977
  return true;
65983
65978
  }
65984
65979
 
@@ -65994,7 +65989,7 @@ public:
65994
65989
 
65995
65990
  namespace duckdb {
65996
65991
 
65997
- class ExpressionScanState : public GlobalSourceState {
65992
+ class ExpressionScanState : public OperatorState {
65998
65993
  public:
65999
65994
  explicit ExpressionScanState(const PhysicalExpressionScan &op) : expression_index(0) {
66000
65995
  temp_chunk.Initialize(op.GetTypes());
@@ -66006,16 +66001,26 @@ public:
66006
66001
  DataChunk temp_chunk;
66007
66002
  };
66008
66003
 
66009
- class ExpressionSinkState : public GlobalSinkState {
66010
- public:
66011
- ExpressionSinkState() {
66012
- }
66004
+ unique_ptr<OperatorState> PhysicalExpressionScan::GetOperatorState(ClientContext &context) const {
66005
+ return make_unique<ExpressionScanState>(*this);
66006
+ }
66013
66007
 
66014
- DataChunk child_chunk;
66015
- };
66008
+ OperatorResultType PhysicalExpressionScan::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk,
66009
+ OperatorState &state_p) const {
66010
+ auto &state = (ExpressionScanState &)state_p;
66016
66011
 
66017
- unique_ptr<GlobalSourceState> PhysicalExpressionScan::GetGlobalSourceState(ClientContext &context) const {
66018
- return make_unique<ExpressionScanState>(*this);
66012
+ for (; chunk.size() + input.size() <= STANDARD_VECTOR_SIZE && state.expression_index < expressions.size();
66013
+ state.expression_index++) {
66014
+ state.temp_chunk.Reset();
66015
+ EvaluateExpression(state.expression_index, &input, state.temp_chunk);
66016
+ chunk.Append(state.temp_chunk);
66017
+ }
66018
+ if (state.expression_index < expressions.size()) {
66019
+ return OperatorResultType::HAVE_MORE_OUTPUT;
66020
+ } else {
66021
+ state.expression_index = 0;
66022
+ return OperatorResultType::NEED_MORE_INPUT;
66023
+ }
66019
66024
  }
66020
66025
 
66021
66026
  void PhysicalExpressionScan::EvaluateExpression(idx_t expression_idx, DataChunk *child_chunk, DataChunk &result) const {
@@ -66028,20 +66033,6 @@ void PhysicalExpressionScan::EvaluateExpression(idx_t expression_idx, DataChunk
66028
66033
  }
66029
66034
  }
66030
66035
 
66031
- void PhysicalExpressionScan::GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate_p,
66032
- LocalSourceState &lstate) const {
66033
- D_ASSERT(sink_state);
66034
- auto &state = (ExpressionScanState &)gstate_p;
66035
- auto &gstate = (ExpressionSinkState &)*sink_state;
66036
-
66037
- for (; chunk.size() < STANDARD_VECTOR_SIZE && state.expression_index < expressions.size();
66038
- state.expression_index++) {
66039
- state.temp_chunk.Reset();
66040
- EvaluateExpression(state.expression_index, &gstate.child_chunk, state.temp_chunk);
66041
- chunk.Append(state.temp_chunk);
66042
- }
66043
- }
66044
-
66045
66036
  bool PhysicalExpressionScan::IsFoldable() const {
66046
66037
  for (auto &expr_list : expressions) {
66047
66038
  for (auto &expr : expr_list) {
@@ -66053,24 +66044,6 @@ bool PhysicalExpressionScan::IsFoldable() const {
66053
66044
  return true;
66054
66045
  }
66055
66046
 
66056
- SinkResultType PhysicalExpressionScan::Sink(ExecutionContext &context, GlobalSinkState &gstate_p,
66057
- LocalSinkState &lstate, DataChunk &input) const {
66058
- auto &gstate = (ExpressionSinkState &)gstate_p;
66059
-
66060
- D_ASSERT(children.size() == 1);
66061
- D_ASSERT(gstate.child_chunk.size() == 0);
66062
- if (input.size() != 1) {
66063
- throw InternalException("Expected expression scan child to have exactly one element");
66064
- }
66065
- gstate.child_chunk.Move(input);
66066
- gstate.child_chunk.Verify();
66067
- return SinkResultType::FINISHED;
66068
- }
66069
-
66070
- unique_ptr<GlobalSinkState> PhysicalExpressionScan::GetGlobalSinkState(ClientContext &context) const {
66071
- return make_unique<ExpressionSinkState>();
66072
- }
66073
-
66074
66047
  } // namespace duckdb
66075
66048
 
66076
66049
 
@@ -126069,7 +126042,6 @@ void Executor::BuildPipelines(PhysicalOperator *op, Pipeline *current) {
126069
126042
  case PhysicalOperatorType::TOP_N:
126070
126043
  case PhysicalOperatorType::COPY_TO_FILE:
126071
126044
  case PhysicalOperatorType::LIMIT:
126072
- case PhysicalOperatorType::EXPRESSION_SCAN:
126073
126045
  case PhysicalOperatorType::EXPLAIN_ANALYZE:
126074
126046
  D_ASSERT(op->children.size() == 1);
126075
126047
  // single operator:
@@ -154822,6 +154794,15 @@ void ExpressionIterator::EnumerateTableRefChildren(BoundTableRef &ref,
154822
154794
  EnumerateTableRefChildren(*bound_crossproduct.right, callback);
154823
154795
  break;
154824
154796
  }
154797
+ case TableReferenceType::EXPRESSION_LIST: {
154798
+ auto &bound_expr_list = (BoundExpressionListRef &)ref;
154799
+ for (auto &expr_list : bound_expr_list.values) {
154800
+ for (auto &expr : expr_list) {
154801
+ EnumerateExpression(expr, callback);
154802
+ }
154803
+ }
154804
+ break;
154805
+ }
154825
154806
  case TableReferenceType::JOIN: {
154826
154807
  auto &bound_join = (BoundJoinRef &)ref;
154827
154808
  EnumerateExpression(bound_join.condition, callback);
@@ -156577,6 +156558,29 @@ unique_ptr<LogicalOperator> FlattenDependentJoins::PushDownDependentJoinInternal
156577
156558
  case LogicalOperatorType::LOGICAL_DISTINCT:
156578
156559
  plan->children[0] = PushDownDependentJoin(move(plan->children[0]));
156579
156560
  return plan;
156561
+ case LogicalOperatorType::LOGICAL_EXPRESSION_GET: {
156562
+ // expression get
156563
+ // first we flatten the dependent join in the child
156564
+ plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0]));
156565
+ // then we replace any correlated expressions with the corresponding entry in the correlated_map
156566
+ RewriteCorrelatedExpressions rewriter(base_binding, correlated_map);
156567
+ rewriter.VisitOperator(*plan);
156568
+ // now we add all the correlated columns to each of the expressions of the expression scan
156569
+ auto expr_get = (LogicalExpressionGet *)plan.get();
156570
+ for (idx_t i = 0; i < correlated_columns.size(); i++) {
156571
+ for (auto &expr_list : expr_get->expressions) {
156572
+ auto colref = make_unique<BoundColumnRefExpression>(
156573
+ correlated_columns[i].type, ColumnBinding(base_binding.table_index, base_binding.column_index + i));
156574
+ expr_list.push_back(move(colref));
156575
+ }
156576
+ expr_get->expr_types.push_back(correlated_columns[i].type);
156577
+ }
156578
+
156579
+ base_binding.table_index = expr_get->table_index;
156580
+ this->delim_offset = base_binding.column_index = expr_get->expr_types.size() - correlated_columns.size();
156581
+ this->data_offset = 0;
156582
+ return plan;
156583
+ }
156580
156584
  case LogicalOperatorType::LOGICAL_ORDER_BY:
156581
156585
  throw ParserException("ORDER BY not supported in correlated subquery");
156582
156586
  default:
package/src/duckdb.hpp CHANGED
@@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
10
10
 
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
- #define DUCKDB_SOURCE_ID "efba70686"
14
- #define DUCKDB_VERSION "0.3.2-dev333"
13
+ #define DUCKDB_SOURCE_ID "c69ecbf73"
14
+ #define DUCKDB_VERSION "0.3.2-dev337"
15
15
  //===----------------------------------------------------------------------===//
16
16
  // DuckDB
17
17
  //