duckdb 0.7.2-dev1803.0 → 0.7.2-dev1867.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/src/catalog/catalog.cpp +27 -27
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +6 -6
- package/src/duckdb/src/catalog/catalog_set.cpp +27 -25
- package/src/duckdb/src/catalog/default/default_functions.cpp +4 -4
- package/src/duckdb/src/catalog/default/default_types.cpp +4 -4
- package/src/duckdb/src/catalog/default/default_views.cpp +4 -4
- package/src/duckdb/src/catalog/dependency_list.cpp +7 -6
- package/src/duckdb/src/catalog/dependency_manager.cpp +44 -38
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +11 -6
- package/src/duckdb/src/common/types/batched_data_collection.cpp +2 -1
- package/src/duckdb/src/common/types/column_data_allocator.cpp +1 -0
- package/src/duckdb/src/common/types/vector.cpp +2 -2
- package/src/duckdb/src/common/vector_operations/vector_copy.cpp +14 -11
- package/src/duckdb/src/execution/operator/aggregate/distinct_aggregate_data.cpp +1 -1
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +51 -50
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +14 -13
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +20 -20
- package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +3 -3
- package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_update.cpp +1 -1
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +3 -3
- package/src/duckdb/src/function/cast/cast_function_set.cpp +2 -1
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +29 -29
- package/src/duckdb/src/function/scalar/string/damerau_levenshtein.cpp +106 -0
- package/src/duckdb/src/function/scalar/string/regexp.cpp +145 -28
- package/src/duckdb/src/function/scalar/string_functions.cpp +1 -0
- package/src/duckdb/src/function/table/checkpoint.cpp +4 -4
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +24 -24
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +7 -6
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_dependencies.cpp +11 -11
- package/src/duckdb/src/function/table/system/pragma_database_size.cpp +1 -1
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +17 -18
- package/src/duckdb/src/function/table/table_scan.cpp +8 -11
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +9 -9
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry_map.hpp +38 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_transaction.hpp +4 -3
- package/src/duckdb/src/include/duckdb/catalog/default/default_functions.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/default/default_types.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/default/default_views.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/dependency.hpp +4 -5
- package/src/duckdb/src/include/duckdb/catalog/dependency_list.hpp +4 -5
- package/src/duckdb/src/include/duckdb/catalog/dependency_manager.hpp +10 -9
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/helper.hpp +9 -0
- package/src/duckdb/src/include/duckdb/common/optional_ptr.hpp +29 -6
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +6 -5
- package/src/duckdb/src/include/duckdb/common/serializer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/row_data_collection.hpp +1 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +5 -5
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +3 -2
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +4 -0
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +4 -3
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +3 -2
- package/src/duckdb/src/include/duckdb/optimizer/filter_combiner.hpp +7 -7
- package/src/duckdb/src/include/duckdb/optimizer/matcher/expression_matcher.hpp +11 -11
- package/src/duckdb/src/include/duckdb/optimizer/matcher/set_matcher.hpp +8 -8
- package/src/duckdb/src/include/duckdb/optimizer/rule/arithmetic_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/case_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/comparison_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/conjunction_simplification.hpp +2 -2
- package/src/duckdb/src/include/duckdb/optimizer/rule/constant_folding.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/date_part_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/distributivity.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/empty_needle_removal.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/enum_comparison.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/equal_or_null_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/in_clause_simplification.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/like_optimizations.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/move_constants.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/ordered_aggregate_optimizer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule/regex_optimizations.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/rule.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/base_expression.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/expression_map.hpp +19 -6
- package/src/duckdb/src/include/duckdb/parser/expression_util.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression.hpp +5 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/order_binder.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +10 -2
- package/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +49 -126
- package/src/duckdb/src/include/duckdb/storage/meta_block_reader.hpp +5 -5
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +159 -0
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +1 -0
- package/src/duckdb/src/include/duckdb/transaction/meta_transaction.hpp +6 -5
- package/src/duckdb/src/main/client_context.cpp +1 -1
- package/src/duckdb/src/main/database.cpp +2 -1
- package/src/duckdb/src/main/database_manager.cpp +4 -4
- package/src/duckdb/src/optimizer/common_aggregate_optimizer.cpp +2 -2
- package/src/duckdb/src/optimizer/cse_optimizer.cpp +4 -4
- package/src/duckdb/src/optimizer/deliminator.cpp +13 -11
- package/src/duckdb/src/optimizer/expression_rewriter.cpp +2 -2
- package/src/duckdb/src/optimizer/filter_combiner.cpp +67 -65
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +1 -0
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +26 -25
- package/src/duckdb/src/optimizer/matcher/expression_matcher.cpp +23 -21
- package/src/duckdb/src/optimizer/rule/arithmetic_simplification.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/case_simplification.cpp +2 -2
- package/src/duckdb/src/optimizer/rule/comparison_simplification.cpp +6 -7
- package/src/duckdb/src/optimizer/rule/conjunction_simplification.cpp +9 -8
- package/src/duckdb/src/optimizer/rule/constant_folding.cpp +7 -7
- package/src/duckdb/src/optimizer/rule/date_part_simplification.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/distributivity.cpp +5 -5
- package/src/duckdb/src/optimizer/rule/empty_needle_removal.cpp +6 -6
- package/src/duckdb/src/optimizer/rule/enum_comparison.cpp +4 -4
- package/src/duckdb/src/optimizer/rule/equal_or_null_simplification.cpp +23 -26
- package/src/duckdb/src/optimizer/rule/in_clause_simplification_rule.cpp +2 -3
- package/src/duckdb/src/optimizer/rule/like_optimizations.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/move_constants.cpp +6 -6
- package/src/duckdb/src/optimizer/rule/ordered_aggregate_optimizer.cpp +2 -2
- package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +3 -3
- package/src/duckdb/src/parser/expression_util.cpp +6 -6
- package/src/duckdb/src/parser/transform/helpers/transform_groupby.cpp +3 -3
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +2 -2
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +3 -3
- package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +5 -5
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +4 -4
- package/src/duckdb/src/planner/expression_binder/order_binder.cpp +3 -3
- package/src/duckdb/src/storage/buffer/block_handle.cpp +3 -2
- package/src/duckdb/src/storage/buffer/block_manager.cpp +3 -1
- package/src/duckdb/src/storage/buffer/buffer_handle.cpp +1 -0
- package/src/duckdb/src/storage/buffer/buffer_pool_reservation.cpp +3 -0
- package/src/duckdb/src/storage/buffer_manager.cpp +35 -726
- package/src/duckdb/src/storage/checkpoint_manager.cpp +2 -2
- package/src/duckdb/src/storage/meta_block_reader.cpp +6 -5
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +801 -0
- package/src/duckdb/src/storage/wal_replay.cpp +2 -2
- package/src/duckdb/src/transaction/meta_transaction.cpp +13 -13
- package/src/duckdb/src/transaction/transaction.cpp +1 -1
- package/src/duckdb/src/transaction/transaction_context.cpp +1 -1
- package/src/duckdb/ub_src_function_scalar_string.cpp +2 -0
- package/src/duckdb/ub_src_storage.cpp +2 -0
@@ -27,7 +27,7 @@ public:
|
|
27
27
|
|
28
28
|
//! Checks if the given expression matches this ExpressionMatcher. If it does, the expression is appended to the
|
29
29
|
//! bindings list and true is returned. Otherwise, false is returned.
|
30
|
-
virtual bool Match(Expression
|
30
|
+
virtual bool Match(Expression &expr, vector<reference<Expression>> &bindings);
|
31
31
|
|
32
32
|
//! The ExpressionClass of the to-be-matched expression. ExpressionClass::INVALID for ANY.
|
33
33
|
ExpressionClass expr_class;
|
@@ -40,14 +40,14 @@ public:
|
|
40
40
|
//! The ExpressionEqualityMatcher matches on equality with another (given) expression
|
41
41
|
class ExpressionEqualityMatcher : public ExpressionMatcher {
|
42
42
|
public:
|
43
|
-
explicit ExpressionEqualityMatcher(Expression
|
43
|
+
explicit ExpressionEqualityMatcher(Expression &expr)
|
44
44
|
: ExpressionMatcher(ExpressionClass::INVALID), expression(expr) {
|
45
45
|
}
|
46
46
|
|
47
|
-
bool Match(Expression
|
47
|
+
bool Match(Expression &expr, vector<reference<Expression>> &bindings) override;
|
48
48
|
|
49
49
|
private:
|
50
|
-
Expression
|
50
|
+
const Expression &expression;
|
51
51
|
};
|
52
52
|
|
53
53
|
class ConstantExpressionMatcher : public ExpressionMatcher {
|
@@ -61,7 +61,7 @@ public:
|
|
61
61
|
CaseExpressionMatcher() : ExpressionMatcher(ExpressionClass::BOUND_CASE) {
|
62
62
|
}
|
63
63
|
|
64
|
-
bool Match(Expression
|
64
|
+
bool Match(Expression &expr_, vector<reference<Expression>> &bindings) override;
|
65
65
|
};
|
66
66
|
|
67
67
|
class ComparisonExpressionMatcher : public ExpressionMatcher {
|
@@ -74,7 +74,7 @@ public:
|
|
74
74
|
//! The set matcher matching policy to use
|
75
75
|
SetMatcher::Policy policy;
|
76
76
|
|
77
|
-
bool Match(Expression
|
77
|
+
bool Match(Expression &expr_, vector<reference<Expression>> &bindings) override;
|
78
78
|
};
|
79
79
|
|
80
80
|
class CastExpressionMatcher : public ExpressionMatcher {
|
@@ -84,7 +84,7 @@ public:
|
|
84
84
|
//! The matcher for the child expressions
|
85
85
|
unique_ptr<ExpressionMatcher> matcher;
|
86
86
|
|
87
|
-
bool Match(Expression
|
87
|
+
bool Match(Expression &expr_, vector<reference<Expression>> &bindings) override;
|
88
88
|
};
|
89
89
|
|
90
90
|
class InClauseExpressionMatcher : public ExpressionMatcher {
|
@@ -96,7 +96,7 @@ public:
|
|
96
96
|
//! The set matcher matching policy to use
|
97
97
|
SetMatcher::Policy policy;
|
98
98
|
|
99
|
-
bool Match(Expression
|
99
|
+
bool Match(Expression &expr_, vector<reference<Expression>> &bindings) override;
|
100
100
|
};
|
101
101
|
|
102
102
|
class ConjunctionExpressionMatcher : public ExpressionMatcher {
|
@@ -109,7 +109,7 @@ public:
|
|
109
109
|
//! The set matcher matching policy to use
|
110
110
|
SetMatcher::Policy policy;
|
111
111
|
|
112
|
-
bool Match(Expression
|
112
|
+
bool Match(Expression &expr_, vector<reference<Expression>> &bindings) override;
|
113
113
|
};
|
114
114
|
|
115
115
|
class FunctionExpressionMatcher : public ExpressionMatcher {
|
@@ -123,7 +123,7 @@ public:
|
|
123
123
|
//! The function name to match
|
124
124
|
unique_ptr<FunctionMatcher> function;
|
125
125
|
|
126
|
-
bool Match(Expression
|
126
|
+
bool Match(Expression &expr_, vector<reference<Expression>> &bindings) override;
|
127
127
|
};
|
128
128
|
|
129
129
|
//! The FoldableConstant matcher matches any expression that is foldable into a constant by the ExpressionExecutor (i.e.
|
@@ -133,7 +133,7 @@ public:
|
|
133
133
|
FoldableConstantMatcher() : ExpressionMatcher(ExpressionClass::INVALID) {
|
134
134
|
}
|
135
135
|
|
136
|
-
bool Match(Expression
|
136
|
+
bool Match(Expression &expr, vector<reference<Expression>> &bindings) override;
|
137
137
|
};
|
138
138
|
|
139
139
|
} // namespace duckdb
|
@@ -29,8 +29,8 @@ public:
|
|
29
29
|
|
30
30
|
/* The double {{}} in the intializer for excluded_entries is intentional, workaround for bug in gcc-4.9 */
|
31
31
|
template <class T, class MATCHER>
|
32
|
-
static bool MatchRecursive(vector<unique_ptr<MATCHER>> &matchers, vector<T
|
33
|
-
unordered_set<idx_t> excluded_entries, idx_t m_idx = 0) {
|
32
|
+
static bool MatchRecursive(vector<unique_ptr<MATCHER>> &matchers, vector<reference<T>> &entries,
|
33
|
+
vector<reference<T>> &bindings, unordered_set<idx_t> excluded_entries, idx_t m_idx = 0) {
|
34
34
|
if (m_idx == matchers.size()) {
|
35
35
|
// matched all matchers!
|
36
36
|
return true;
|
@@ -65,8 +65,8 @@ public:
|
|
65
65
|
}
|
66
66
|
|
67
67
|
template <class T, class MATCHER>
|
68
|
-
static bool Match(vector<unique_ptr<MATCHER>> &matchers, vector<T
|
69
|
-
Policy policy) {
|
68
|
+
static bool Match(vector<unique_ptr<MATCHER>> &matchers, vector<reference<T>> &entries,
|
69
|
+
vector<reference<T>> &bindings, Policy policy) {
|
70
70
|
if (policy == Policy::ORDERED) {
|
71
71
|
// ordered policy, count has to match
|
72
72
|
if (matchers.size() != entries.size()) {
|
@@ -100,12 +100,12 @@ public:
|
|
100
100
|
}
|
101
101
|
|
102
102
|
template <class T, class MATCHER>
|
103
|
-
static bool Match(vector<unique_ptr<MATCHER>> &matchers, vector<unique_ptr<T>> &entries,
|
104
|
-
Policy policy) {
|
103
|
+
static bool Match(vector<unique_ptr<MATCHER>> &matchers, vector<unique_ptr<T>> &entries,
|
104
|
+
vector<reference<T>> &bindings, Policy policy) {
|
105
105
|
// convert vector of unique_ptr to vector of normal pointers
|
106
|
-
vector<T
|
106
|
+
vector<reference<T>> ptr_entries;
|
107
107
|
for (auto &entry : entries) {
|
108
|
-
ptr_entries.push_back(entry
|
108
|
+
ptr_entries.push_back(*entry);
|
109
109
|
}
|
110
110
|
// then just call the normal match function
|
111
111
|
return Match(matchers, ptr_entries, bindings, policy);
|
@@ -18,7 +18,7 @@ class ArithmeticSimplificationRule : public Rule {
|
|
18
18
|
public:
|
19
19
|
explicit ArithmeticSimplificationRule(ExpressionRewriter &rewriter);
|
20
20
|
|
21
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
21
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
22
22
|
bool is_root) override;
|
23
23
|
};
|
24
24
|
|
@@ -17,7 +17,7 @@ class CaseSimplificationRule : public Rule {
|
|
17
17
|
public:
|
18
18
|
explicit CaseSimplificationRule(ExpressionRewriter &rewriter);
|
19
19
|
|
20
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
20
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
21
21
|
bool is_root) override;
|
22
22
|
};
|
23
23
|
|
@@ -17,7 +17,7 @@ class ComparisonSimplificationRule : public Rule {
|
|
17
17
|
public:
|
18
18
|
explicit ComparisonSimplificationRule(ExpressionRewriter &rewriter);
|
19
19
|
|
20
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
20
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
21
21
|
bool is_root) override;
|
22
22
|
};
|
23
23
|
|
@@ -17,10 +17,10 @@ class ConjunctionSimplificationRule : public Rule {
|
|
17
17
|
public:
|
18
18
|
explicit ConjunctionSimplificationRule(ExpressionRewriter &rewriter);
|
19
19
|
|
20
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
20
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
21
21
|
bool is_root) override;
|
22
22
|
|
23
|
-
unique_ptr<Expression> RemoveExpression(BoundConjunctionExpression &conj, Expression
|
23
|
+
unique_ptr<Expression> RemoveExpression(BoundConjunctionExpression &conj, const Expression &expr);
|
24
24
|
};
|
25
25
|
|
26
26
|
} // namespace duckdb
|
@@ -17,7 +17,7 @@ class ConstantFoldingRule : public Rule {
|
|
17
17
|
public:
|
18
18
|
explicit ConstantFoldingRule(ExpressionRewriter &rewriter);
|
19
19
|
|
20
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
20
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
21
21
|
bool is_root) override;
|
22
22
|
};
|
23
23
|
|
@@ -18,7 +18,7 @@ class DatePartSimplificationRule : public Rule {
|
|
18
18
|
public:
|
19
19
|
explicit DatePartSimplificationRule(ExpressionRewriter &rewriter);
|
20
20
|
|
21
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
21
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
22
22
|
bool is_root) override;
|
23
23
|
};
|
24
24
|
|
@@ -18,7 +18,7 @@ class DistributivityRule : public Rule {
|
|
18
18
|
public:
|
19
19
|
explicit DistributivityRule(ExpressionRewriter &rewriter);
|
20
20
|
|
21
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
21
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
22
22
|
bool is_root) override;
|
23
23
|
|
24
24
|
private:
|
@@ -18,7 +18,7 @@ class EmptyNeedleRemovalRule : public Rule {
|
|
18
18
|
public:
|
19
19
|
explicit EmptyNeedleRemovalRule(ExpressionRewriter &rewriter);
|
20
20
|
|
21
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
21
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
22
22
|
bool is_root) override;
|
23
23
|
};
|
24
24
|
|
@@ -17,7 +17,7 @@ class EnumComparisonRule : public Rule {
|
|
17
17
|
public:
|
18
18
|
explicit EnumComparisonRule(ExpressionRewriter &rewriter);
|
19
19
|
|
20
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
20
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
21
21
|
bool is_root) override;
|
22
22
|
};
|
23
23
|
|
@@ -18,7 +18,7 @@ class EqualOrNullSimplification : public Rule {
|
|
18
18
|
public:
|
19
19
|
explicit EqualOrNullSimplification(ExpressionRewriter &rewriter);
|
20
20
|
|
21
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
21
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
22
22
|
bool is_root) override;
|
23
23
|
};
|
24
24
|
|
@@ -17,7 +17,7 @@ class InClauseSimplificationRule : public Rule {
|
|
17
17
|
public:
|
18
18
|
explicit InClauseSimplificationRule(ExpressionRewriter &rewriter);
|
19
19
|
|
20
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
20
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
21
21
|
bool is_root) override;
|
22
22
|
};
|
23
23
|
|
@@ -18,7 +18,7 @@ class LikeOptimizationRule : public Rule {
|
|
18
18
|
public:
|
19
19
|
explicit LikeOptimizationRule(ExpressionRewriter &rewriter);
|
20
20
|
|
21
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
21
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
22
22
|
bool is_root) override;
|
23
23
|
|
24
24
|
unique_ptr<Expression> ApplyRule(BoundFunctionExpression &expr, ScalarFunction function, string pattern,
|
@@ -18,7 +18,7 @@ class MoveConstantsRule : public Rule {
|
|
18
18
|
public:
|
19
19
|
explicit MoveConstantsRule(ExpressionRewriter &rewriter);
|
20
20
|
|
21
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
21
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
22
22
|
bool is_root) override;
|
23
23
|
};
|
24
24
|
|
@@ -17,7 +17,7 @@ class OrderedAggregateOptimizer : public Rule {
|
|
17
17
|
public:
|
18
18
|
explicit OrderedAggregateOptimizer(ExpressionRewriter &rewriter);
|
19
19
|
|
20
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
20
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
21
21
|
bool is_root) override;
|
22
22
|
};
|
23
23
|
|
@@ -17,7 +17,7 @@ class RegexOptimizationRule : public Rule {
|
|
17
17
|
public:
|
18
18
|
explicit RegexOptimizationRule(ExpressionRewriter &rewriter);
|
19
19
|
|
20
|
-
unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
20
|
+
unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings, bool &changes_made,
|
21
21
|
bool is_root) override;
|
22
22
|
|
23
23
|
unique_ptr<Expression> ApplyRule(BoundFunctionExpression *expr, ScalarFunction function, string pattern,
|
@@ -29,8 +29,8 @@ public:
|
|
29
29
|
unique_ptr<ExpressionMatcher> root;
|
30
30
|
|
31
31
|
ClientContext &GetContext() const;
|
32
|
-
virtual unique_ptr<Expression> Apply(LogicalOperator &op, vector<Expression
|
33
|
-
bool is_root) = 0;
|
32
|
+
virtual unique_ptr<Expression> Apply(LogicalOperator &op, vector<reference<Expression>> &bindings,
|
33
|
+
bool &fixed_point, bool is_root) = 0;
|
34
34
|
};
|
35
35
|
|
36
36
|
} // namespace duckdb
|
@@ -73,7 +73,7 @@ public:
|
|
73
73
|
//! Returns true if this expression is equal to another expression
|
74
74
|
virtual bool Equals(const BaseExpression *other) const;
|
75
75
|
|
76
|
-
static bool Equals(BaseExpression *left, BaseExpression *right) {
|
76
|
+
static bool Equals(const BaseExpression *left, const BaseExpression *right) {
|
77
77
|
if (left == right) {
|
78
78
|
return true;
|
79
79
|
}
|
@@ -11,25 +11,38 @@
|
|
11
11
|
#include "duckdb/common/unordered_map.hpp"
|
12
12
|
#include "duckdb/common/unordered_set.hpp"
|
13
13
|
#include "duckdb/parser/base_expression.hpp"
|
14
|
+
#include "duckdb/parser/parsed_expression.hpp"
|
15
|
+
#include "duckdb/planner/expression.hpp"
|
14
16
|
|
15
17
|
namespace duckdb {
|
16
18
|
class Expression;
|
17
19
|
|
20
|
+
template <class T>
|
18
21
|
struct ExpressionHashFunction {
|
19
|
-
uint64_t operator()(const
|
20
|
-
return (uint64_t)expr
|
22
|
+
uint64_t operator()(const reference<T> &expr) const {
|
23
|
+
return (uint64_t)expr.get().Hash();
|
21
24
|
}
|
22
25
|
};
|
23
26
|
|
27
|
+
template <class T>
|
24
28
|
struct ExpressionEquality {
|
25
|
-
bool operator()(const
|
26
|
-
return a
|
29
|
+
bool operator()(const reference<T> &a, const reference<T> &b) const {
|
30
|
+
return a.get().Equals(&b.get());
|
27
31
|
}
|
28
32
|
};
|
29
33
|
|
30
34
|
template <typename T>
|
31
|
-
using expression_map_t =
|
35
|
+
using expression_map_t =
|
36
|
+
unordered_map<reference<Expression>, T, ExpressionHashFunction<Expression>, ExpressionEquality<Expression>>;
|
32
37
|
|
33
|
-
using expression_set_t =
|
38
|
+
using expression_set_t =
|
39
|
+
unordered_set<reference<Expression>, ExpressionHashFunction<Expression>, ExpressionEquality<Expression>>;
|
40
|
+
|
41
|
+
template <typename T>
|
42
|
+
using parsed_expression_map_t = unordered_map<reference<ParsedExpression>, T, ExpressionHashFunction<ParsedExpression>,
|
43
|
+
ExpressionEquality<ParsedExpression>>;
|
44
|
+
|
45
|
+
using parsed_expression_set_t = unordered_set<reference<ParsedExpression>, ExpressionHashFunction<ParsedExpression>,
|
46
|
+
ExpressionEquality<ParsedExpression>>;
|
34
47
|
|
35
48
|
} // namespace duckdb
|
@@ -28,7 +28,7 @@ public:
|
|
28
28
|
private:
|
29
29
|
template <class T>
|
30
30
|
static bool ExpressionListEquals(const vector<unique_ptr<T>> &a, const vector<unique_ptr<T>> &b);
|
31
|
-
template <class T>
|
31
|
+
template <class T, class EXPRESSION_MAP>
|
32
32
|
static bool ExpressionSetEquals(const vector<unique_ptr<T>> &a, const vector<unique_ptr<T>> &b);
|
33
33
|
};
|
34
34
|
|
@@ -48,8 +48,11 @@ public:
|
|
48
48
|
return return_type == ((Expression *)other)->return_type;
|
49
49
|
}
|
50
50
|
|
51
|
-
static bool Equals(Expression *left, Expression *right) {
|
52
|
-
return BaseExpression::Equals((BaseExpression *)left, (BaseExpression *)right);
|
51
|
+
static bool Equals(const Expression *left, const Expression *right) {
|
52
|
+
return BaseExpression::Equals((const BaseExpression *)left, (const BaseExpression *)right);
|
53
|
+
}
|
54
|
+
static bool Equals(const Expression &left, const Expression &right) {
|
55
|
+
return left.Equals(&right);
|
53
56
|
}
|
54
57
|
//! Create a copy of this expression
|
55
58
|
virtual unique_ptr<Expression> Copy() = 0;
|
@@ -22,9 +22,9 @@ class SelectNode;
|
|
22
22
|
class OrderBinder {
|
23
23
|
public:
|
24
24
|
OrderBinder(vector<Binder *> binders, idx_t projection_index, case_insensitive_map_t<idx_t> &alias_map,
|
25
|
-
|
25
|
+
parsed_expression_map_t<idx_t> &projection_map, idx_t max_count);
|
26
26
|
OrderBinder(vector<Binder *> binders, idx_t projection_index, SelectNode &node,
|
27
|
-
case_insensitive_map_t<idx_t> &alias_map,
|
27
|
+
case_insensitive_map_t<idx_t> &alias_map, parsed_expression_map_t<idx_t> &projection_map);
|
28
28
|
|
29
29
|
public:
|
30
30
|
unique_ptr<Expression> Bind(unique_ptr<ParsedExpression> expr);
|
@@ -51,7 +51,7 @@ private:
|
|
51
51
|
idx_t max_count;
|
52
52
|
vector<unique_ptr<ParsedExpression>> *extra_list;
|
53
53
|
case_insensitive_map_t<idx_t> &alias_map;
|
54
|
-
|
54
|
+
parsed_expression_map_t<idx_t> &projection_map;
|
55
55
|
};
|
56
56
|
|
57
57
|
} // namespace duckdb
|
@@ -26,8 +26,7 @@ struct BufferPoolReservation {
|
|
26
26
|
idx_t size {0};
|
27
27
|
BufferPool &pool;
|
28
28
|
|
29
|
-
BufferPoolReservation(BufferPool &pool)
|
30
|
-
}
|
29
|
+
BufferPoolReservation(BufferPool &pool);
|
31
30
|
BufferPoolReservation(const BufferPoolReservation &) = delete;
|
32
31
|
BufferPoolReservation &operator=(const BufferPoolReservation &) = delete;
|
33
32
|
|
@@ -55,6 +54,7 @@ class BlockHandle {
|
|
55
54
|
friend struct BufferEvictionNode;
|
56
55
|
friend class BufferHandle;
|
57
56
|
friend class BufferManager;
|
57
|
+
friend class StandardBufferManager;
|
58
58
|
friend class BufferPool;
|
59
59
|
|
60
60
|
public:
|
@@ -70,6 +70,14 @@ public:
|
|
70
70
|
return block_id;
|
71
71
|
}
|
72
72
|
|
73
|
+
void ResizeBuffer(idx_t block_size, int64_t memory_delta) {
|
74
|
+
D_ASSERT(buffer);
|
75
|
+
// resize and adjust current memory
|
76
|
+
buffer->Resize(block_size);
|
77
|
+
memory_usage += memory_delta;
|
78
|
+
D_ASSERT(memory_usage == buffer->AllocSize());
|
79
|
+
}
|
80
|
+
|
73
81
|
int32_t Readers() const {
|
74
82
|
return readers;
|
75
83
|
}
|