duckdb 0.3.2-dev333.0 → 0.3.2-dev343.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 +1 -1
- package/src/duckdb.cpp +64 -54
- package/src/duckdb.hpp +2 -2
package/package.json
CHANGED
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
|
-
|
|
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<
|
|
65971
|
-
|
|
65972
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
66010
|
-
|
|
66011
|
-
|
|
66012
|
-
}
|
|
66004
|
+
unique_ptr<OperatorState> PhysicalExpressionScan::GetOperatorState(ClientContext &context) const {
|
|
66005
|
+
return make_unique<ExpressionScanState>(*this);
|
|
66006
|
+
}
|
|
66013
66007
|
|
|
66014
|
-
|
|
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
|
-
|
|
66018
|
-
|
|
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
|
|
|
@@ -90049,6 +90022,8 @@ void InstrFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
90049
90022
|
set.AddFunction(instr);
|
|
90050
90023
|
instr.name = "strpos";
|
|
90051
90024
|
set.AddFunction(instr);
|
|
90025
|
+
instr.name = "position";
|
|
90026
|
+
set.AddFunction(instr);
|
|
90052
90027
|
}
|
|
90053
90028
|
|
|
90054
90029
|
} // namespace duckdb
|
|
@@ -117164,6 +117139,8 @@ struct CSEReplacementState {
|
|
|
117164
117139
|
column_binding_map_t<idx_t> column_map;
|
|
117165
117140
|
//! The set of expressions of the resulting projection
|
|
117166
117141
|
vector<unique_ptr<Expression>> expressions;
|
|
117142
|
+
//! Cached expressions that are kept around so the expression_map always contains valid expressions
|
|
117143
|
+
vector<unique_ptr<Expression>> cached_expressions;
|
|
117167
117144
|
};
|
|
117168
117145
|
|
|
117169
117146
|
void CommonSubExpressionOptimizer::VisitOperator(LogicalOperator &op) {
|
|
@@ -117239,6 +117216,8 @@ void CommonSubExpressionOptimizer::PerformCSEReplacement(unique_ptr<Expression>
|
|
|
117239
117216
|
// has not been pushed yet: push it
|
|
117240
117217
|
node.column_index = state.expressions.size();
|
|
117241
117218
|
state.expressions.push_back(move(*expr_ptr));
|
|
117219
|
+
} else {
|
|
117220
|
+
state.cached_expressions.push_back(move(*expr_ptr));
|
|
117242
117221
|
}
|
|
117243
117222
|
// replace the original expression with a bound column ref
|
|
117244
117223
|
*expr_ptr = make_unique<BoundColumnRefExpression>(alias, type,
|
|
@@ -126069,7 +126048,6 @@ void Executor::BuildPipelines(PhysicalOperator *op, Pipeline *current) {
|
|
|
126069
126048
|
case PhysicalOperatorType::TOP_N:
|
|
126070
126049
|
case PhysicalOperatorType::COPY_TO_FILE:
|
|
126071
126050
|
case PhysicalOperatorType::LIMIT:
|
|
126072
|
-
case PhysicalOperatorType::EXPRESSION_SCAN:
|
|
126073
126051
|
case PhysicalOperatorType::EXPLAIN_ANALYZE:
|
|
126074
126052
|
D_ASSERT(op->children.size() == 1);
|
|
126075
126053
|
// single operator:
|
|
@@ -154822,6 +154800,15 @@ void ExpressionIterator::EnumerateTableRefChildren(BoundTableRef &ref,
|
|
|
154822
154800
|
EnumerateTableRefChildren(*bound_crossproduct.right, callback);
|
|
154823
154801
|
break;
|
|
154824
154802
|
}
|
|
154803
|
+
case TableReferenceType::EXPRESSION_LIST: {
|
|
154804
|
+
auto &bound_expr_list = (BoundExpressionListRef &)ref;
|
|
154805
|
+
for (auto &expr_list : bound_expr_list.values) {
|
|
154806
|
+
for (auto &expr : expr_list) {
|
|
154807
|
+
EnumerateExpression(expr, callback);
|
|
154808
|
+
}
|
|
154809
|
+
}
|
|
154810
|
+
break;
|
|
154811
|
+
}
|
|
154825
154812
|
case TableReferenceType::JOIN: {
|
|
154826
154813
|
auto &bound_join = (BoundJoinRef &)ref;
|
|
154827
154814
|
EnumerateExpression(bound_join.condition, callback);
|
|
@@ -156577,6 +156564,29 @@ unique_ptr<LogicalOperator> FlattenDependentJoins::PushDownDependentJoinInternal
|
|
|
156577
156564
|
case LogicalOperatorType::LOGICAL_DISTINCT:
|
|
156578
156565
|
plan->children[0] = PushDownDependentJoin(move(plan->children[0]));
|
|
156579
156566
|
return plan;
|
|
156567
|
+
case LogicalOperatorType::LOGICAL_EXPRESSION_GET: {
|
|
156568
|
+
// expression get
|
|
156569
|
+
// first we flatten the dependent join in the child
|
|
156570
|
+
plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0]));
|
|
156571
|
+
// then we replace any correlated expressions with the corresponding entry in the correlated_map
|
|
156572
|
+
RewriteCorrelatedExpressions rewriter(base_binding, correlated_map);
|
|
156573
|
+
rewriter.VisitOperator(*plan);
|
|
156574
|
+
// now we add all the correlated columns to each of the expressions of the expression scan
|
|
156575
|
+
auto expr_get = (LogicalExpressionGet *)plan.get();
|
|
156576
|
+
for (idx_t i = 0; i < correlated_columns.size(); i++) {
|
|
156577
|
+
for (auto &expr_list : expr_get->expressions) {
|
|
156578
|
+
auto colref = make_unique<BoundColumnRefExpression>(
|
|
156579
|
+
correlated_columns[i].type, ColumnBinding(base_binding.table_index, base_binding.column_index + i));
|
|
156580
|
+
expr_list.push_back(move(colref));
|
|
156581
|
+
}
|
|
156582
|
+
expr_get->expr_types.push_back(correlated_columns[i].type);
|
|
156583
|
+
}
|
|
156584
|
+
|
|
156585
|
+
base_binding.table_index = expr_get->table_index;
|
|
156586
|
+
this->delim_offset = base_binding.column_index = expr_get->expr_types.size() - correlated_columns.size();
|
|
156587
|
+
this->data_offset = 0;
|
|
156588
|
+
return plan;
|
|
156589
|
+
}
|
|
156580
156590
|
case LogicalOperatorType::LOGICAL_ORDER_BY:
|
|
156581
156591
|
throw ParserException("ORDER BY not supported in correlated subquery");
|
|
156582
156592
|
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 "
|
|
14
|
-
#define DUCKDB_VERSION "0.3.2-
|
|
13
|
+
#define DUCKDB_SOURCE_ID "9efc37201"
|
|
14
|
+
#define DUCKDB_VERSION "0.3.2-dev343"
|
|
15
15
|
//===----------------------------------------------------------------------===//
|
|
16
16
|
// DuckDB
|
|
17
17
|
//
|