duckdb 0.7.2-dev2320.0 → 0.7.2-dev2366.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/data_chunk.cpp +1 -1
- package/src/duckdb/extension/icu/icu-extension.cpp +2 -2
- package/src/duckdb/extension/icu/icu-makedate.cpp +52 -0
- package/src/duckdb/extension/icu/icu-strptime.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/calendar.cpp +4 -0
- package/src/duckdb/extension/icu/third_party/icu/i18n/dangical.cpp +28 -28
- package/src/duckdb/extension/icu/third_party/icu/i18n/dangical.h +4 -4
- package/src/duckdb/extension/json/include/json_common.hpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_create.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +1 -1
- package/src/duckdb/extension/json/json_functions.cpp +2 -2
- package/src/duckdb/extension/json/json_serializer.cpp +1 -1
- package/src/duckdb/extension/parquet/column_reader.cpp +1 -1
- package/src/duckdb/extension/parquet/column_writer.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +2 -2
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +2 -2
- package/src/duckdb/src/common/operator/cast_operators.cpp +24 -25
- package/src/duckdb/src/common/row_operations/row_heap_scatter.cpp +2 -2
- package/src/duckdb/src/common/row_operations/row_scatter.cpp +1 -1
- package/src/duckdb/src/common/types/bit.cpp +18 -18
- package/src/duckdb/src/common/types/blob.cpp +7 -7
- package/src/duckdb/src/common/types/column/column_data_allocator.cpp +1 -1
- package/src/duckdb/src/common/types/column/column_data_collection.cpp +1 -1
- package/src/duckdb/src/common/types/hash.cpp +1 -1
- package/src/duckdb/src/common/types/hyperloglog.cpp +1 -1
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +2 -2
- package/src/duckdb/src/common/types/string_heap.cpp +2 -2
- package/src/duckdb/src/common/types/string_type.cpp +2 -2
- package/src/duckdb/src/common/types/timestamp.cpp +1 -1
- package/src/duckdb/src/common/types/vector.cpp +7 -7
- package/src/duckdb/src/execution/index/art/art_key.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +1 -1
- package/src/duckdb/src/function/aggregate/distributive/arg_min_max.cpp +2 -2
- package/src/duckdb/src/function/aggregate/distributive/bitagg.cpp +2 -2
- package/src/duckdb/src/function/aggregate/distributive/bitstring_agg.cpp +2 -2
- package/src/duckdb/src/function/aggregate/distributive/first.cpp +2 -2
- package/src/duckdb/src/function/aggregate/distributive/kurtosis.cpp +3 -2
- package/src/duckdb/src/function/aggregate/distributive/minmax.cpp +2 -2
- package/src/duckdb/src/function/aggregate/distributive/skew.cpp +5 -1
- package/src/duckdb/src/function/aggregate/distributive/string_agg.cpp +1 -1
- package/src/duckdb/src/function/cast/list_casts.cpp +1 -1
- package/src/duckdb/src/function/cast/struct_cast.cpp +1 -1
- package/src/duckdb/src/function/cast/vector_cast_helpers.cpp +3 -3
- package/src/duckdb/src/function/scalar/bit/bitstring.cpp +1 -1
- package/src/duckdb/src/function/scalar/blob/encode.cpp +1 -1
- package/src/duckdb/src/function/scalar/date/strftime.cpp +3 -3
- package/src/duckdb/src/function/scalar/generic/current_setting.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/ascii.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/caseconvert.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/concat.cpp +6 -6
- package/src/duckdb/src/function/scalar/string/contains.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/damerau_levenshtein.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/hex.cpp +4 -4
- package/src/duckdb/src/function/scalar/string/instr.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/jaccard.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/jaro_winkler.cpp +5 -5
- package/src/duckdb/src/function/scalar/string/length.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/levenshtein.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/like.cpp +10 -11
- package/src/duckdb/src/function/scalar/string/mismatches.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/nfc_normalize.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/pad.cpp +3 -3
- package/src/duckdb/src/function/scalar/string/prefix.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/printf.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/regexp/regexp_extract_all.cpp +4 -4
- package/src/duckdb/src/function/scalar/string/repeat.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/replace.cpp +3 -3
- package/src/duckdb/src/function/scalar/string/reverse.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/starts_with.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/string_split.cpp +3 -3
- package/src/duckdb/src/function/scalar/string/strip_accents.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/substring.cpp +3 -3
- package/src/duckdb/src/function/scalar/string/suffix.cpp +2 -2
- package/src/duckdb/src/function/scalar/string/translate.cpp +3 -3
- package/src/duckdb/src/function/scalar/string/trim.cpp +3 -3
- package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +1 -1
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +5 -7
- package/src/duckdb/src/function/scalar/union/union_extract.cpp +1 -1
- package/src/duckdb/src/function/table/copy_csv.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +2 -2
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/common/crypto/md5.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/radix.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/string_type.hpp +8 -6
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +17 -0
- package/src/duckdb/src/include/duckdb/function/scalar/regexp.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar/string_functions.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +3 -0
- package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/capi/cast/utils.hpp +1 -1
- package/src/duckdb/src/include/duckdb/optimizer/cse_optimizer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/aggregate_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/alter_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +4 -3
- package/src/duckdb/src/include/duckdb/planner/expression_binder/check_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/constant_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/group_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/having_binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/index_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/insert_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/lateral_binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/qualify_binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/relation_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/returning_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/update_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/where_binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +12 -9
- package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +1 -1
- package/src/duckdb/src/main/capi/cast/from_decimal-c.cpp +1 -1
- package/src/duckdb/src/main/capi/result-c.cpp +2 -2
- package/src/duckdb/src/optimizer/cse_optimizer.cpp +9 -8
- package/src/duckdb/src/parser/expression/subquery_expression.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +2 -0
- package/src/duckdb/src/parser/transform/statement/transform_select_node.cpp +33 -29
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +6 -5
- package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +2 -2
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +8 -7
- package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +2 -2
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +6 -6
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +2 -2
- package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +1 -1
- package/src/duckdb/src/planner/binder/query_node/plan_select_node.cpp +8 -8
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +5 -5
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +2 -2
- package/src/duckdb/src/planner/binder/tableref/plan_expressionlistref.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +4 -4
- package/src/duckdb/src/planner/expression.cpp +2 -1
- package/src/duckdb/src/planner/expression_binder/aggregate_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/alter_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +4 -4
- package/src/duckdb/src/planner/expression_binder/check_binder.cpp +4 -4
- package/src/duckdb/src/planner/expression_binder/column_alias_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/constant_binder.cpp +3 -3
- package/src/duckdb/src/planner/expression_binder/group_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/having_binder.cpp +4 -4
- package/src/duckdb/src/planner/expression_binder/index_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/insert_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +3 -3
- package/src/duckdb/src/planner/expression_binder/qualify_binder.cpp +4 -4
- package/src/duckdb/src/planner/expression_binder/relation_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/returning_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +3 -3
- package/src/duckdb/src/planner/expression_binder/update_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/where_binder.cpp +4 -4
- package/src/duckdb/src/planner/expression_binder.cpp +12 -12
- package/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp +2 -2
- package/src/duckdb/src/storage/compression/dictionary_compression.cpp +1 -1
- package/src/duckdb/src/storage/compression/fsst.cpp +3 -3
- package/src/duckdb/src/storage/compression/string_uncompressed.cpp +1 -1
- package/src/duckdb/src/storage/statistics/string_stats.cpp +2 -2
- package/src/statement.cpp +3 -3
@@ -60,7 +60,7 @@ static Value NegatePercentileValue(const Value &v, const bool desc) {
|
|
60
60
|
static void NegatePercentileFractions(ClientContext &context, unique_ptr<ParsedExpression> &fractions, bool desc) {
|
61
61
|
D_ASSERT(fractions.get());
|
62
62
|
D_ASSERT(fractions->expression_class == ExpressionClass::BOUND_EXPRESSION);
|
63
|
-
auto &bound = (
|
63
|
+
auto &bound = fractions->Cast<BoundExpression>();
|
64
64
|
|
65
65
|
if (!bound.expr->IsFoldable()) {
|
66
66
|
return;
|
@@ -81,7 +81,8 @@ static void NegatePercentileFractions(ClientContext &context, unique_ptr<ParsedE
|
|
81
81
|
}
|
82
82
|
}
|
83
83
|
|
84
|
-
BindResult BaseSelectBinder::BindAggregate(FunctionExpression &aggr, AggregateFunctionCatalogEntry
|
84
|
+
BindResult BaseSelectBinder::BindAggregate(FunctionExpression &aggr, optional_ptr<AggregateFunctionCatalogEntry> func,
|
85
|
+
idx_t depth) {
|
85
86
|
// first bind the child of the aggregate expression (if any)
|
86
87
|
this->bound_aggregate = true;
|
87
88
|
unique_ptr<Expression> bound_filter;
|
@@ -137,7 +138,7 @@ BindResult BaseSelectBinder::BindAggregate(FunctionExpression &aggr, AggregateFu
|
|
137
138
|
if (!success) {
|
138
139
|
throw BinderException(error);
|
139
140
|
}
|
140
|
-
auto &bound_expr =
|
141
|
+
auto &bound_expr = aggr.children[i]->Cast<BoundExpression>();
|
141
142
|
ExtractCorrelatedExpressions(binder, *bound_expr.expr);
|
142
143
|
}
|
143
144
|
if (aggr.filter) {
|
@@ -146,7 +147,7 @@ BindResult BaseSelectBinder::BindAggregate(FunctionExpression &aggr, AggregateFu
|
|
146
147
|
if (!success) {
|
147
148
|
throw BinderException(error);
|
148
149
|
}
|
149
|
-
auto &bound_expr =
|
150
|
+
auto &bound_expr = aggr.filter->Cast<BoundExpression>();
|
150
151
|
ExtractCorrelatedExpressions(binder, *bound_expr.expr);
|
151
152
|
}
|
152
153
|
if (aggr.order_bys && !aggr.order_bys->orders.empty()) {
|
@@ -155,7 +156,7 @@ BindResult BaseSelectBinder::BindAggregate(FunctionExpression &aggr, AggregateFu
|
|
155
156
|
if (!success) {
|
156
157
|
throw BinderException(error);
|
157
158
|
}
|
158
|
-
auto &bound_expr =
|
159
|
+
auto &bound_expr = order.expression->Cast<BoundExpression>();
|
159
160
|
ExtractCorrelatedExpressions(binder, *bound_expr.expr);
|
160
161
|
}
|
161
162
|
}
|
@@ -8,7 +8,7 @@ namespace duckdb {
|
|
8
8
|
|
9
9
|
BindResult ExpressionBinder::BindExpression(CastExpression &expr, idx_t depth) {
|
10
10
|
// first try to bind the child of the cast expression
|
11
|
-
string error = Bind(
|
11
|
+
string error = Bind(expr.child, depth);
|
12
12
|
if (!error.empty()) {
|
13
13
|
return BindResult(error);
|
14
14
|
}
|
@@ -6,11 +6,11 @@ namespace duckdb {
|
|
6
6
|
|
7
7
|
BindResult ExpressionBinder::BindExpression(CollateExpression &expr, idx_t depth) {
|
8
8
|
// first try to bind the child of the cast expression
|
9
|
-
string error = Bind(
|
9
|
+
string error = Bind(expr.child, depth);
|
10
10
|
if (!error.empty()) {
|
11
11
|
return BindResult(error);
|
12
12
|
}
|
13
|
-
auto &child =
|
13
|
+
auto &child = expr.child->Cast<BoundExpression>();
|
14
14
|
if (child.expr->HasParameter()) {
|
15
15
|
throw ParameterNotResolvedException();
|
16
16
|
}
|
@@ -340,7 +340,7 @@ BindResult ExpressionBinder::BindExpression(ColumnRefExpression &colref_p, idx_t
|
|
340
340
|
// a generated column returns a generated expression, a struct on a column returns a struct extract
|
341
341
|
if (expr->type != ExpressionType::COLUMN_REF) {
|
342
342
|
auto alias = expr->alias;
|
343
|
-
auto result = BindExpression(
|
343
|
+
auto result = BindExpression(expr, depth);
|
344
344
|
if (result.expression) {
|
345
345
|
result.expression->alias = std::move(alias);
|
346
346
|
}
|
@@ -15,7 +15,7 @@
|
|
15
15
|
namespace duckdb {
|
16
16
|
|
17
17
|
BindResult ExpressionBinder::BindExpression(FunctionExpression &function, idx_t depth,
|
18
|
-
unique_ptr<ParsedExpression>
|
18
|
+
unique_ptr<ParsedExpression> &expr_ptr) {
|
19
19
|
// lookup the function in the catalog
|
20
20
|
QueryErrorContext error_context(binder.root_statement, function.query_location);
|
21
21
|
auto func = Catalog::GetEntry(context, CatalogType::SCALAR_FUNCTION_ENTRY, function.catalog, function.schema,
|
@@ -87,7 +87,8 @@ BindResult ExpressionBinder::BindExpression(FunctionExpression &function, idx_t
|
|
87
87
|
}
|
88
88
|
}
|
89
89
|
|
90
|
-
BindResult ExpressionBinder::BindFunction(FunctionExpression &function, ScalarFunctionCatalogEntry
|
90
|
+
BindResult ExpressionBinder::BindFunction(FunctionExpression &function, optional_ptr<ScalarFunctionCatalogEntry> func,
|
91
|
+
idx_t depth) {
|
91
92
|
|
92
93
|
// bind the children of the function expression
|
93
94
|
string error;
|
@@ -122,8 +123,8 @@ BindResult ExpressionBinder::BindFunction(FunctionExpression &function, ScalarFu
|
|
122
123
|
return BindResult(std::move(result));
|
123
124
|
}
|
124
125
|
|
125
|
-
BindResult ExpressionBinder::BindLambdaFunction(FunctionExpression &function,
|
126
|
-
idx_t depth) {
|
126
|
+
BindResult ExpressionBinder::BindLambdaFunction(FunctionExpression &function,
|
127
|
+
optional_ptr<ScalarFunctionCatalogEntry> func, idx_t depth) {
|
127
128
|
|
128
129
|
// bind the children of the function expression
|
129
130
|
string error;
|
@@ -140,7 +141,7 @@ BindResult ExpressionBinder::BindLambdaFunction(FunctionExpression &function, Sc
|
|
140
141
|
}
|
141
142
|
|
142
143
|
// get the logical type of the children of the list
|
143
|
-
auto &list_child =
|
144
|
+
auto &list_child = function.children[0]->Cast<BoundExpression>();
|
144
145
|
|
145
146
|
if (list_child.expr->return_type.id() != LogicalTypeId::LIST &&
|
146
147
|
list_child.expr->return_type.id() != LogicalTypeId::SQLNULL &&
|
@@ -233,8 +234,8 @@ BindResult ExpressionBinder::BindLambdaFunction(FunctionExpression &function, Sc
|
|
233
234
|
return BindResult(std::move(result));
|
234
235
|
}
|
235
236
|
|
236
|
-
BindResult ExpressionBinder::BindAggregate(FunctionExpression &expr,
|
237
|
-
idx_t depth) {
|
237
|
+
BindResult ExpressionBinder::BindAggregate(FunctionExpression &expr,
|
238
|
+
optional_ptr<AggregateFunctionCatalogEntry> function, idx_t depth) {
|
238
239
|
return BindResult(binder.FormatError(expr, UnsupportedAggregateMessage()));
|
239
240
|
}
|
240
241
|
|
@@ -78,13 +78,13 @@ BindResult ExpressionBinder::BindExpression(LambdaExpression &expr, idx_t depth,
|
|
78
78
|
|
79
79
|
// bind the parameter expressions
|
80
80
|
for (idx_t i = 0; i < expr.params.size(); i++) {
|
81
|
-
auto result = BindExpression(
|
81
|
+
auto result = BindExpression(expr.params[i], depth, false);
|
82
82
|
if (result.HasError()) {
|
83
83
|
throw InternalException("Error during lambda binding: %s", result.error);
|
84
84
|
}
|
85
85
|
}
|
86
86
|
|
87
|
-
auto result = BindExpression(
|
87
|
+
auto result = BindExpression(expr.expr, depth, false);
|
88
88
|
lambda_bindings->pop_back();
|
89
89
|
|
90
90
|
// successfully bound a subtree of nested lambdas, set this to nullptr in case other parts of the
|
@@ -44,10 +44,10 @@ void ExpressionBinder::ReplaceMacroParametersRecursive(unique_ptr<ParsedExpressi
|
|
44
44
|
*expr, [&](unique_ptr<ParsedExpression> &child) { ReplaceMacroParametersRecursive(child); });
|
45
45
|
}
|
46
46
|
|
47
|
-
BindResult ExpressionBinder::BindMacro(FunctionExpression &function, ScalarMacroCatalogEntry
|
48
|
-
unique_ptr<ParsedExpression>
|
47
|
+
BindResult ExpressionBinder::BindMacro(FunctionExpression &function, optional_ptr<ScalarMacroCatalogEntry> macro_func,
|
48
|
+
idx_t depth, unique_ptr<ParsedExpression> &expr) {
|
49
49
|
// recast function so we can access the scalar member function->expression
|
50
|
-
auto ¯o_def =
|
50
|
+
auto ¯o_def = macro_func->function->Cast<ScalarMacroFunction>();
|
51
51
|
|
52
52
|
// validate the arguments and separate positional and default arguments
|
53
53
|
vector<unique_ptr<ParsedExpression>> positionals;
|
@@ -56,7 +56,7 @@ BindResult ExpressionBinder::BindMacro(FunctionExpression &function, ScalarMacro
|
|
56
56
|
string error =
|
57
57
|
MacroFunction::ValidateArguments(*macro_func->function, macro_func->name, function, positionals, defaults);
|
58
58
|
if (!error.empty()) {
|
59
|
-
throw BinderException(binder.FormatError(*expr
|
59
|
+
throw BinderException(binder.FormatError(*expr, error));
|
60
60
|
}
|
61
61
|
|
62
62
|
// create a MacroBinding to bind this macro's parameters to its arguments
|
@@ -80,8 +80,8 @@ BindResult ExpressionBinder::BindMacro(FunctionExpression &function, ScalarMacro
|
|
80
80
|
macro_binding = new_macro_binding.get();
|
81
81
|
|
82
82
|
// replace current expression with stored macro expression, and replace params
|
83
|
-
|
84
|
-
ReplaceMacroParametersRecursive(
|
83
|
+
expr = macro_def.expression->Copy();
|
84
|
+
ReplaceMacroParametersRecursive(expr);
|
85
85
|
|
86
86
|
// bind the unfolded macro
|
87
87
|
return BindExpression(expr, depth);
|
@@ -127,8 +127,8 @@ BindResult ExpressionBinder::BindExpression(OperatorExpression &op, idx_t depth)
|
|
127
127
|
break;
|
128
128
|
}
|
129
129
|
if (!function_name.empty()) {
|
130
|
-
auto function =
|
131
|
-
return BindExpression(
|
130
|
+
auto function = make_uniq_base<ParsedExpression, FunctionExpression>(function_name, std::move(op.children));
|
131
|
+
return BindExpression(function, depth, false);
|
132
132
|
}
|
133
133
|
|
134
134
|
vector<BoundExpression *> children;
|
@@ -67,7 +67,7 @@ BindResult ExpressionBinder::BindExpression(SubqueryExpression &expr, idx_t dept
|
|
67
67
|
// now bind the child node of the subquery
|
68
68
|
if (expr.child) {
|
69
69
|
// first bind the children of the subquery, if any
|
70
|
-
string error = Bind(
|
70
|
+
string error = Bind(expr.child, depth);
|
71
71
|
if (!error.empty()) {
|
72
72
|
return BindResult(error);
|
73
73
|
}
|
@@ -19,7 +19,7 @@ namespace duckdb {
|
|
19
19
|
unique_ptr<QueryNode> Binder::BindTableMacro(FunctionExpression &function, TableMacroCatalogEntry *macro_func,
|
20
20
|
idx_t depth) {
|
21
21
|
|
22
|
-
auto ¯o_def =
|
22
|
+
auto ¯o_def = macro_func->function->Cast<TableMacroFunction>();
|
23
23
|
auto node = macro_def.query_node->Copy();
|
24
24
|
|
25
25
|
// auto ¯o_def = *macro_func->function;
|
@@ -9,7 +9,7 @@
|
|
9
9
|
namespace duckdb {
|
10
10
|
|
11
11
|
unique_ptr<LogicalOperator> Binder::PlanFilter(unique_ptr<Expression> condition, unique_ptr<LogicalOperator> root) {
|
12
|
-
PlanSubqueries(
|
12
|
+
PlanSubqueries(condition, root);
|
13
13
|
auto filter = make_uniq<LogicalFilter>(std::move(condition));
|
14
14
|
filter->AddChild(std::move(root));
|
15
15
|
return std::move(filter);
|
@@ -34,12 +34,12 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
|
|
34
34
|
if (!statement.groups.group_expressions.empty()) {
|
35
35
|
// visit the groups
|
36
36
|
for (auto &group : statement.groups.group_expressions) {
|
37
|
-
PlanSubqueries(
|
37
|
+
PlanSubqueries(group, root);
|
38
38
|
}
|
39
39
|
}
|
40
40
|
// now visit all aggregate expressions
|
41
41
|
for (auto &expr : statement.aggregates) {
|
42
|
-
PlanSubqueries(
|
42
|
+
PlanSubqueries(expr, root);
|
43
43
|
}
|
44
44
|
// finally create the aggregate node with the group_index and aggregate_index as obtained from the binder
|
45
45
|
auto aggregate = make_uniq<LogicalAggregate>(statement.group_index, statement.aggregate_index,
|
@@ -59,7 +59,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
|
|
59
59
|
}
|
60
60
|
|
61
61
|
if (statement.having) {
|
62
|
-
PlanSubqueries(
|
62
|
+
PlanSubqueries(statement.having, root);
|
63
63
|
auto having = make_uniq<LogicalFilter>(std::move(statement.having));
|
64
64
|
|
65
65
|
having->AddChild(std::move(root));
|
@@ -71,7 +71,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
|
|
71
71
|
win->expressions = std::move(statement.windows);
|
72
72
|
// visit the window expressions
|
73
73
|
for (auto &expr : win->expressions) {
|
74
|
-
PlanSubqueries(
|
74
|
+
PlanSubqueries(expr, root);
|
75
75
|
}
|
76
76
|
D_ASSERT(!win->expressions.empty());
|
77
77
|
win->AddChild(std::move(root));
|
@@ -79,7 +79,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
|
|
79
79
|
}
|
80
80
|
|
81
81
|
if (statement.qualify) {
|
82
|
-
PlanSubqueries(
|
82
|
+
PlanSubqueries(statement.qualify, root);
|
83
83
|
auto qualify = make_uniq<LogicalFilter>(std::move(statement.qualify));
|
84
84
|
|
85
85
|
qualify->AddChild(std::move(root));
|
@@ -97,7 +97,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
|
|
97
97
|
unnest->expressions = std::move(unnest_node.expressions);
|
98
98
|
// visit the unnest expressions
|
99
99
|
for (auto &expr : unnest->expressions) {
|
100
|
-
PlanSubqueries(
|
100
|
+
PlanSubqueries(expr, root);
|
101
101
|
}
|
102
102
|
D_ASSERT(!unnest->expressions.empty());
|
103
103
|
unnest->AddChild(std::move(root));
|
@@ -105,7 +105,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
|
|
105
105
|
}
|
106
106
|
|
107
107
|
for (auto &expr : statement.select_list) {
|
108
|
-
PlanSubqueries(
|
108
|
+
PlanSubqueries(expr, root);
|
109
109
|
}
|
110
110
|
|
111
111
|
auto proj = make_uniq<LogicalProjection>(statement.projection_index, std::move(statement.select_list));
|
@@ -378,14 +378,14 @@ unique_ptr<Expression> Binder::PlanSubquery(BoundSubqueryExpression &expr, uniqu
|
|
378
378
|
return result_expression;
|
379
379
|
}
|
380
380
|
|
381
|
-
void Binder::PlanSubqueries(unique_ptr<Expression>
|
382
|
-
if (
|
381
|
+
void Binder::PlanSubqueries(unique_ptr<Expression> &expr_ptr, unique_ptr<LogicalOperator> &root) {
|
382
|
+
if (!expr_ptr) {
|
383
383
|
return;
|
384
384
|
}
|
385
|
-
auto &expr =
|
385
|
+
auto &expr = *expr_ptr;
|
386
386
|
|
387
387
|
// first visit the children of the node, if any
|
388
|
-
ExpressionIterator::EnumerateChildren(expr, [&](unique_ptr<Expression> &expr) { PlanSubqueries(
|
388
|
+
ExpressionIterator::EnumerateChildren(expr, [&](unique_ptr<Expression> &expr) { PlanSubqueries(expr, root); });
|
389
389
|
|
390
390
|
// check if this is a subquery node
|
391
391
|
if (expr.expression_class == ExpressionClass::BOUND_SUBQUERY) {
|
@@ -398,7 +398,7 @@ void Binder::PlanSubqueries(unique_ptr<Expression> *expr_ptr, unique_ptr<Logical
|
|
398
398
|
has_unplanned_subqueries = true;
|
399
399
|
return;
|
400
400
|
}
|
401
|
-
|
401
|
+
expr_ptr = PlanSubquery(subquery, root);
|
402
402
|
}
|
403
403
|
}
|
404
404
|
|
@@ -161,7 +161,7 @@ static void QualifyFunctionNames(ClientContext &context, unique_ptr<ParsedExpres
|
|
161
161
|
|
162
162
|
SchemaCatalogEntry &Binder::BindCreateFunctionInfo(CreateInfo &info) {
|
163
163
|
auto &base = (CreateMacroInfo &)info;
|
164
|
-
auto &scalar_function =
|
164
|
+
auto &scalar_function = base.function->Cast<ScalarMacroFunction>();
|
165
165
|
|
166
166
|
if (scalar_function.expression->HasParameter()) {
|
167
167
|
throw BinderException("Parameter expressions within macro's are not supported!");
|
@@ -198,7 +198,7 @@ SchemaCatalogEntry &Binder::BindCreateFunctionInfo(CreateInfo &info) {
|
|
198
198
|
auto sel_node = make_uniq<BoundSelectNode>();
|
199
199
|
auto group_info = make_uniq<BoundGroupInformation>();
|
200
200
|
SelectBinder binder(*this, context, *sel_node, *group_info);
|
201
|
-
error = binder.Bind(
|
201
|
+
error = binder.Bind(expression, 0, false);
|
202
202
|
|
203
203
|
if (!error.empty()) {
|
204
204
|
throw BinderException(error);
|
@@ -62,7 +62,7 @@ BoundStatement Binder::Bind(DeleteStatement &stmt) {
|
|
62
62
|
WhereBinder binder(*this, context);
|
63
63
|
condition = binder.Bind(stmt.condition);
|
64
64
|
|
65
|
-
PlanSubqueries(
|
65
|
+
PlanSubqueries(condition, root);
|
66
66
|
auto filter = make_uniq<LogicalFilter>(std::move(condition));
|
67
67
|
filter->AddChild(std::move(root));
|
68
68
|
root = std::move(filter);
|
@@ -162,7 +162,7 @@ unique_ptr<LogicalOperator> Binder::BindUpdateSet(LogicalOperator &op, unique_pt
|
|
162
162
|
UpdateBinder binder(*this, context);
|
163
163
|
binder.target_type = column.Type();
|
164
164
|
auto bound_expr = binder.Bind(expr);
|
165
|
-
PlanSubqueries(
|
165
|
+
PlanSubqueries(bound_expr, root);
|
166
166
|
|
167
167
|
op.expressions.push_back(make_uniq<BoundColumnRefExpression>(
|
168
168
|
bound_expr->return_type, ColumnBinding(proj_index, projection_expressions.size())));
|
@@ -225,7 +225,7 @@ BoundStatement Binder::Bind(UpdateStatement &stmt) {
|
|
225
225
|
WhereBinder binder(*this, context);
|
226
226
|
auto condition = binder.Bind(stmt.set_info->condition);
|
227
227
|
|
228
|
-
PlanSubqueries(
|
228
|
+
PlanSubqueries(condition, root);
|
229
229
|
auto filter = make_uniq<LogicalFilter>(std::move(condition));
|
230
230
|
filter->AddChild(std::move(root));
|
231
231
|
root = std::move(filter);
|
@@ -10,7 +10,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundExpressionListRef &ref) {
|
|
10
10
|
// values list, first plan any subqueries in the list
|
11
11
|
for (auto &expr_list : ref.values) {
|
12
12
|
for (auto &expr : expr_list) {
|
13
|
-
PlanSubqueries(
|
13
|
+
PlanSubqueries(expr, root);
|
14
14
|
}
|
15
15
|
}
|
16
16
|
// now create a LogicalExpressionGet from the set of expressions
|
@@ -268,7 +268,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundJoinRef &ref) {
|
|
268
268
|
auto filter = make_uniq<LogicalFilter>(std::move(ref.condition));
|
269
269
|
// visit the expressions in the filter
|
270
270
|
for (auto &expression : filter->expressions) {
|
271
|
-
PlanSubqueries(
|
271
|
+
PlanSubqueries(expression, root);
|
272
272
|
}
|
273
273
|
filter->AddChild(std::move(root));
|
274
274
|
return std::move(filter);
|
@@ -288,7 +288,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundJoinRef &ref) {
|
|
288
288
|
if (child->type == LogicalOperatorType::LOGICAL_FILTER) {
|
289
289
|
auto &filter = child->Cast<LogicalFilter>();
|
290
290
|
for (auto &expr : filter.expressions) {
|
291
|
-
PlanSubqueries(
|
291
|
+
PlanSubqueries(expr, filter.children[0]);
|
292
292
|
}
|
293
293
|
}
|
294
294
|
}
|
@@ -302,8 +302,8 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundJoinRef &ref) {
|
|
302
302
|
// and the expressions on the RHS with the RHS as root node
|
303
303
|
auto &comp_join = join->Cast<LogicalComparisonJoin>();
|
304
304
|
for (idx_t i = 0; i < comp_join.conditions.size(); i++) {
|
305
|
-
PlanSubqueries(
|
306
|
-
PlanSubqueries(
|
305
|
+
PlanSubqueries(comp_join.conditions[i].left, comp_join.children[0]);
|
306
|
+
PlanSubqueries(comp_join.conditions[i].right, comp_join.children[1]);
|
307
307
|
}
|
308
308
|
break;
|
309
309
|
}
|
@@ -51,7 +51,8 @@ bool Expression::HasSideEffects() const {
|
|
51
51
|
bool Expression::PropagatesNullValues() const {
|
52
52
|
if (type == ExpressionType::OPERATOR_IS_NULL || type == ExpressionType::OPERATOR_IS_NOT_NULL ||
|
53
53
|
type == ExpressionType::COMPARE_NOT_DISTINCT_FROM || type == ExpressionType::COMPARE_DISTINCT_FROM ||
|
54
|
-
type == ExpressionType::CONJUNCTION_OR || type == ExpressionType::CONJUNCTION_AND
|
54
|
+
type == ExpressionType::CONJUNCTION_OR || type == ExpressionType::CONJUNCTION_AND ||
|
55
|
+
type == ExpressionType::OPERATOR_COALESCE) {
|
55
56
|
return false;
|
56
57
|
}
|
57
58
|
bool propagate_null_values = true;
|
@@ -7,8 +7,8 @@ namespace duckdb {
|
|
7
7
|
AggregateBinder::AggregateBinder(Binder &binder, ClientContext &context) : ExpressionBinder(binder, context, true) {
|
8
8
|
}
|
9
9
|
|
10
|
-
BindResult AggregateBinder::BindExpression(unique_ptr<ParsedExpression>
|
11
|
-
auto &expr =
|
10
|
+
BindResult AggregateBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
11
|
+
auto &expr = *expr_ptr;
|
12
12
|
switch (expr.expression_class) {
|
13
13
|
case ExpressionClass::WINDOW:
|
14
14
|
throw ParserException("aggregate function calls cannot contain window function calls");
|
@@ -12,8 +12,8 @@ AlterBinder::AlterBinder(Binder &binder, ClientContext &context, TableCatalogEnt
|
|
12
12
|
this->target_type = std::move(target_type);
|
13
13
|
}
|
14
14
|
|
15
|
-
BindResult AlterBinder::BindExpression(unique_ptr<ParsedExpression>
|
16
|
-
auto &expr =
|
15
|
+
BindResult AlterBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
16
|
+
auto &expr = *expr_ptr;
|
17
17
|
switch (expr.GetExpressionClass()) {
|
18
18
|
case ExpressionClass::WINDOW:
|
19
19
|
return BindResult("window functions are not allowed in alter statement");
|
@@ -23,8 +23,8 @@ BaseSelectBinder::BaseSelectBinder(Binder &binder, ClientContext &context, Bound
|
|
23
23
|
: BaseSelectBinder(binder, context, node, info, case_insensitive_map_t<idx_t>()) {
|
24
24
|
}
|
25
25
|
|
26
|
-
BindResult BaseSelectBinder::BindExpression(unique_ptr<ParsedExpression>
|
27
|
-
auto &expr =
|
26
|
+
BindResult BaseSelectBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
27
|
+
auto &expr = *expr_ptr;
|
28
28
|
// check if the expression binds to one of the groups
|
29
29
|
auto group_index = TryBindGroup(expr, depth);
|
30
30
|
if (group_index != DConstants::INVALID_INDEX) {
|
@@ -69,7 +69,7 @@ idx_t BaseSelectBinder::TryBindGroup(ParsedExpression &expr, idx_t depth) {
|
|
69
69
|
return DConstants::INVALID_INDEX;
|
70
70
|
}
|
71
71
|
|
72
|
-
BindResult BaseSelectBinder::BindColumnRef(unique_ptr<ParsedExpression>
|
72
|
+
BindResult BaseSelectBinder::BindColumnRef(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth) {
|
73
73
|
// first try to bind the column reference regularly
|
74
74
|
auto result = ExpressionBinder::BindExpression(expr_ptr, depth);
|
75
75
|
if (!result.HasError()) {
|
@@ -77,7 +77,7 @@ BindResult BaseSelectBinder::BindColumnRef(unique_ptr<ParsedExpression> *expr_pt
|
|
77
77
|
}
|
78
78
|
// binding failed
|
79
79
|
// check in the alias map
|
80
|
-
auto &colref = (
|
80
|
+
auto &colref = (expr_ptr.get())->Cast<ColumnRefExpression>();
|
81
81
|
if (!colref.IsQualified()) {
|
82
82
|
auto alias_entry = alias_map.find(colref.column_names[0]);
|
83
83
|
if (alias_entry != alias_map.end()) {
|
@@ -12,8 +12,8 @@ CheckBinder::CheckBinder(Binder &binder, ClientContext &context, string table_p,
|
|
12
12
|
target_type = LogicalType::INTEGER;
|
13
13
|
}
|
14
14
|
|
15
|
-
BindResult CheckBinder::BindExpression(unique_ptr<ParsedExpression>
|
16
|
-
auto &expr =
|
15
|
+
BindResult CheckBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
16
|
+
auto &expr = *expr_ptr;
|
17
17
|
switch (expr.GetExpressionClass()) {
|
18
18
|
case ExpressionClass::WINDOW:
|
19
19
|
return BindResult("window functions are not allowed in check constraints");
|
@@ -39,7 +39,7 @@ BindResult ExpressionBinder::BindQualifiedColumnName(ColumnRefExpression &colref
|
|
39
39
|
for (idx_t i = struct_start; i + 1 < colref.column_names.size(); i++) {
|
40
40
|
result = CreateStructExtract(std::move(result), colref.column_names[i]);
|
41
41
|
}
|
42
|
-
return BindExpression(
|
42
|
+
return BindExpression(result, 0);
|
43
43
|
}
|
44
44
|
|
45
45
|
BindResult CheckBinder::BindCheckColumn(ColumnRefExpression &colref) {
|
@@ -66,7 +66,7 @@ BindResult CheckBinder::BindCheckColumn(ColumnRefExpression &colref) {
|
|
66
66
|
auto &col = columns.GetColumn(colref.column_names[0]);
|
67
67
|
if (col.Generated()) {
|
68
68
|
auto bound_expression = col.GeneratedExpression().Copy();
|
69
|
-
return BindExpression(
|
69
|
+
return BindExpression(bound_expression, 0, false);
|
70
70
|
}
|
71
71
|
bound_columns.insert(col.Physical());
|
72
72
|
D_ASSERT(col.StorageOid() != DConstants::INVALID_INDEX);
|
@@ -33,7 +33,7 @@ BindResult ColumnAliasBinder::BindAlias(ExpressionBinder &enclosing_binder, Colu
|
|
33
33
|
|
34
34
|
// since the alias has been found, pass a depth of 0. See Issue 4978 (#16)
|
35
35
|
// ColumnAliasBinders are only in Having, Qualify and Where Binders
|
36
|
-
auto result = enclosing_binder.BindExpression(
|
36
|
+
auto result = enclosing_binder.BindExpression(expression, 0, root_expression);
|
37
37
|
visited_select_indexes.erase(alias_entry->second);
|
38
38
|
return result;
|
39
39
|
}
|
@@ -7,15 +7,15 @@ ConstantBinder::ConstantBinder(Binder &binder, ClientContext &context, string cl
|
|
7
7
|
: ExpressionBinder(binder, context), clause(std::move(clause)) {
|
8
8
|
}
|
9
9
|
|
10
|
-
BindResult ConstantBinder::BindExpression(unique_ptr<ParsedExpression>
|
11
|
-
auto &expr =
|
10
|
+
BindResult ConstantBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
11
|
+
auto &expr = *expr_ptr;
|
12
12
|
switch (expr.GetExpressionClass()) {
|
13
13
|
case ExpressionClass::COLUMN_REF: {
|
14
14
|
auto &colref = expr.Cast<ColumnRefExpression>();
|
15
15
|
if (!colref.IsQualified()) {
|
16
16
|
auto value_function = GetSQLValueFunction(colref.GetColumnName());
|
17
17
|
if (value_function) {
|
18
|
-
|
18
|
+
expr_ptr = std::move(value_function);
|
19
19
|
return BindExpression(expr_ptr, depth, root_expression);
|
20
20
|
}
|
21
21
|
}
|
@@ -14,8 +14,8 @@ GroupBinder::GroupBinder(Binder &binder, ClientContext &context, SelectNode &nod
|
|
14
14
|
group_index(group_index) {
|
15
15
|
}
|
16
16
|
|
17
|
-
BindResult GroupBinder::BindExpression(unique_ptr<ParsedExpression>
|
18
|
-
auto &expr =
|
17
|
+
BindResult GroupBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
18
|
+
auto &expr = *expr_ptr;
|
19
19
|
if (root_expression && depth == 0) {
|
20
20
|
switch (expr.expression_class) {
|
21
21
|
case ExpressionClass::COLUMN_REF:
|
@@ -15,8 +15,8 @@ HavingBinder::HavingBinder(Binder &binder, ClientContext &context, BoundSelectNo
|
|
15
15
|
target_type = LogicalType(LogicalTypeId::BOOLEAN);
|
16
16
|
}
|
17
17
|
|
18
|
-
BindResult HavingBinder::BindColumnRef(unique_ptr<ParsedExpression>
|
19
|
-
auto &expr = (
|
18
|
+
BindResult HavingBinder::BindColumnRef(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
19
|
+
auto &expr = expr_ptr->Cast<ColumnRefExpression>();
|
20
20
|
auto alias_result = column_alias_binder.BindAlias(*this, expr, depth, root_expression);
|
21
21
|
if (!alias_result.HasError()) {
|
22
22
|
if (depth > 0) {
|
@@ -41,8 +41,8 @@ BindResult HavingBinder::BindColumnRef(unique_ptr<ParsedExpression> *expr_ptr, i
|
|
41
41
|
"column %s must appear in the GROUP BY clause or be used in an aggregate function", expr.ToString()));
|
42
42
|
}
|
43
43
|
|
44
|
-
BindResult HavingBinder::BindExpression(unique_ptr<ParsedExpression>
|
45
|
-
auto &expr =
|
44
|
+
BindResult HavingBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
45
|
+
auto &expr = *expr_ptr;
|
46
46
|
// check if the expression binds to one of the groups
|
47
47
|
auto group_index = TryBindGroup(expr, depth);
|
48
48
|
if (group_index != DConstants::INVALID_INDEX) {
|
@@ -12,8 +12,8 @@ IndexBinder::IndexBinder(Binder &binder, ClientContext &context, optional_ptr<Ta
|
|
12
12
|
: ExpressionBinder(binder, context), table(table), info(info) {
|
13
13
|
}
|
14
14
|
|
15
|
-
BindResult IndexBinder::BindExpression(unique_ptr<ParsedExpression>
|
16
|
-
auto &expr =
|
15
|
+
BindResult IndexBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
16
|
+
auto &expr = *expr_ptr;
|
17
17
|
switch (expr.expression_class) {
|
18
18
|
case ExpressionClass::WINDOW:
|
19
19
|
return BindResult("window functions are not allowed in index expressions");
|
@@ -7,8 +7,8 @@ namespace duckdb {
|
|
7
7
|
InsertBinder::InsertBinder(Binder &binder, ClientContext &context) : ExpressionBinder(binder, context) {
|
8
8
|
}
|
9
9
|
|
10
|
-
BindResult InsertBinder::BindExpression(unique_ptr<ParsedExpression>
|
11
|
-
auto &expr =
|
10
|
+
BindResult InsertBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
11
|
+
auto &expr = *expr_ptr;
|
12
12
|
switch (expr.GetExpressionClass()) {
|
13
13
|
case ExpressionClass::DEFAULT:
|
14
14
|
return BindResult("DEFAULT is not allowed here!");
|
@@ -23,7 +23,7 @@ void LateralBinder::ExtractCorrelatedColumns(Expression &expr) {
|
|
23
23
|
ExpressionIterator::EnumerateChildren(expr, [&](Expression &child) { ExtractCorrelatedColumns(child); });
|
24
24
|
}
|
25
25
|
|
26
|
-
BindResult LateralBinder::BindColumnRef(unique_ptr<ParsedExpression>
|
26
|
+
BindResult LateralBinder::BindColumnRef(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
27
27
|
if (depth == 0) {
|
28
28
|
throw InternalException("Lateral binder can only bind correlated columns");
|
29
29
|
}
|
@@ -66,8 +66,8 @@ vector<CorrelatedColumnInfo> LateralBinder::ExtractCorrelatedColumns(Binder &bin
|
|
66
66
|
return all_correlated_columns;
|
67
67
|
}
|
68
68
|
|
69
|
-
BindResult LateralBinder::BindExpression(unique_ptr<ParsedExpression>
|
70
|
-
auto &expr =
|
69
|
+
BindResult LateralBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
70
|
+
auto &expr = *expr_ptr;
|
71
71
|
switch (expr.GetExpressionClass()) {
|
72
72
|
case ExpressionClass::DEFAULT:
|
73
73
|
return BindResult("LATERAL join cannot contain DEFAULT clause");
|
@@ -15,8 +15,8 @@ QualifyBinder::QualifyBinder(Binder &binder, ClientContext &context, BoundSelect
|
|
15
15
|
target_type = LogicalType(LogicalTypeId::BOOLEAN);
|
16
16
|
}
|
17
17
|
|
18
|
-
BindResult QualifyBinder::BindColumnRef(unique_ptr<ParsedExpression>
|
19
|
-
auto &expr = (
|
18
|
+
BindResult QualifyBinder::BindColumnRef(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
19
|
+
auto &expr = expr_ptr->Cast<ColumnRefExpression>();
|
20
20
|
auto result = duckdb::BaseSelectBinder::BindExpression(expr_ptr, depth);
|
21
21
|
if (!result.HasError()) {
|
22
22
|
return result;
|
@@ -31,8 +31,8 @@ BindResult QualifyBinder::BindColumnRef(unique_ptr<ParsedExpression> *expr_ptr,
|
|
31
31
|
expr.ToString()));
|
32
32
|
}
|
33
33
|
|
34
|
-
BindResult QualifyBinder::BindExpression(unique_ptr<ParsedExpression>
|
35
|
-
auto &expr =
|
34
|
+
BindResult QualifyBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
35
|
+
auto &expr = *expr_ptr;
|
36
36
|
// check if the expression binds to one of the groups
|
37
37
|
auto group_index = TryBindGroup(expr, depth);
|
38
38
|
if (group_index != DConstants::INVALID_INDEX) {
|
@@ -6,8 +6,8 @@ RelationBinder::RelationBinder(Binder &binder, ClientContext &context, string op
|
|
6
6
|
: ExpressionBinder(binder, context), op(std::move(op)) {
|
7
7
|
}
|
8
8
|
|
9
|
-
BindResult RelationBinder::BindExpression(unique_ptr<ParsedExpression>
|
10
|
-
auto &expr =
|
9
|
+
BindResult RelationBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
|
10
|
+
auto &expr = *expr_ptr;
|
11
11
|
switch (expr.expression_class) {
|
12
12
|
case ExpressionClass::AGGREGATE:
|
13
13
|
return BindResult("aggregate functions are not allowed in " + op);
|