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
@@ -26,7 +26,7 @@ public:
|
|
26
26
|
}
|
27
27
|
void Add(const char *data);
|
28
28
|
void Add(string_t string) {
|
29
|
-
MD5Update((const_data_ptr_t)string.
|
29
|
+
MD5Update((const_data_ptr_t)string.GetData(), string.GetSize());
|
30
30
|
}
|
31
31
|
void Add(const string &data) {
|
32
32
|
MD5Update((const_data_ptr_t)data.c_str(), data.size());
|
@@ -50,7 +50,7 @@ public:
|
|
50
50
|
|
51
51
|
static inline void EncodeStringDataPrefix(data_ptr_t dataptr, string_t value, idx_t prefix_len) {
|
52
52
|
auto len = value.GetSize();
|
53
|
-
memcpy(dataptr, value.
|
53
|
+
memcpy(dataptr, value.GetData(), MinValue(len, prefix_len));
|
54
54
|
if (len < prefix_len) {
|
55
55
|
memset(dataptr + len, '\0', prefix_len - len);
|
56
56
|
}
|
@@ -68,10 +68,12 @@ public:
|
|
68
68
|
return GetSize() <= INLINE_LENGTH;
|
69
69
|
}
|
70
70
|
|
71
|
-
|
72
|
-
const char *GetDataUnsafe() const {
|
71
|
+
const char *GetData() const {
|
73
72
|
return IsInlined() ? (const char *)value.inlined.inlined : value.pointer.ptr;
|
74
73
|
}
|
74
|
+
const char *GetDataUnsafe() const {
|
75
|
+
return GetData();
|
76
|
+
}
|
75
77
|
|
76
78
|
char *GetDataWriteable() const {
|
77
79
|
return IsInlined() ? (char *)value.inlined.inlined : value.pointer.ptr;
|
@@ -86,7 +88,7 @@ public:
|
|
86
88
|
}
|
87
89
|
|
88
90
|
string GetString() const {
|
89
|
-
return string(
|
91
|
+
return string(GetData(), GetSize());
|
90
92
|
}
|
91
93
|
|
92
94
|
explicit operator string() const {
|
@@ -108,7 +110,7 @@ public:
|
|
108
110
|
} else {
|
109
111
|
// copy the data into the prefix
|
110
112
|
#ifndef DUCKDB_DEBUG_NO_INLINE
|
111
|
-
auto dataptr = (char *)
|
113
|
+
auto dataptr = (char *)GetData();
|
112
114
|
memcpy(value.pointer.prefix, dataptr, PREFIX_LENGTH);
|
113
115
|
#else
|
114
116
|
memset(value.pointer.prefix, 0, PREFIX_BYTES);
|
@@ -124,7 +126,7 @@ public:
|
|
124
126
|
#ifdef DUCKDB_DEBUG_NO_INLINE
|
125
127
|
if (a.GetSize() != b.GetSize())
|
126
128
|
return false;
|
127
|
-
return (memcmp(a.
|
129
|
+
return (memcmp(a.GetData(), b.GetData(), a.GetSize()) == 0);
|
128
130
|
#endif
|
129
131
|
uint64_t A = Load<uint64_t>((const_data_ptr_t)&a);
|
130
132
|
uint64_t B = Load<uint64_t>((const_data_ptr_t)&b);
|
@@ -177,7 +179,7 @@ public:
|
|
177
179
|
if (A != B)
|
178
180
|
return bswap(A) > bswap(B);
|
179
181
|
#endif
|
180
|
-
auto memcmp_res = memcmp(left.
|
182
|
+
auto memcmp_res = memcmp(left.GetData(), right.GetData(), min_length);
|
181
183
|
return memcmp_res > 0 || (memcmp_res == 0 && left_length > right_length);
|
182
184
|
}
|
183
185
|
};
|
@@ -143,7 +143,7 @@ public:
|
|
143
143
|
return heap.AddString(data);
|
144
144
|
}
|
145
145
|
string_t AddBlob(string_t data) {
|
146
|
-
return heap.AddBlob(data.
|
146
|
+
return heap.AddBlob(data.GetData(), data.GetSize());
|
147
147
|
}
|
148
148
|
string_t EmptyString(idx_t len) {
|
149
149
|
return heap.EmptyString(len);
|
@@ -44,6 +44,23 @@ public:
|
|
44
44
|
unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
|
45
45
|
|
46
46
|
virtual string ToSQL(const string &schema, const string &name) const;
|
47
|
+
|
48
|
+
public:
|
49
|
+
template <class TARGET>
|
50
|
+
TARGET &Cast() {
|
51
|
+
if (type != TARGET::TYPE) {
|
52
|
+
throw InternalException("Failed to cast macro to type - macro type mismatch");
|
53
|
+
}
|
54
|
+
return (TARGET &)*this;
|
55
|
+
}
|
56
|
+
|
57
|
+
template <class TARGET>
|
58
|
+
const TARGET &Cast() const {
|
59
|
+
if (type != TARGET::TYPE) {
|
60
|
+
throw InternalException("Failed to cast macro to type - macro type mismatch");
|
61
|
+
}
|
62
|
+
return (const TARGET &)*this;
|
63
|
+
}
|
47
64
|
};
|
48
65
|
|
49
66
|
} // namespace duckdb
|
@@ -22,7 +22,7 @@ void ParseRegexOptions(const string &options, duckdb_re2::RE2::Options &result,
|
|
22
22
|
void ParseRegexOptions(ClientContext &context, Expression &expr, RE2::Options &target, bool *global_replace = nullptr);
|
23
23
|
|
24
24
|
inline duckdb_re2::StringPiece CreateStringPiece(const string_t &input) {
|
25
|
-
return duckdb_re2::StringPiece(input.
|
25
|
+
return duckdb_re2::StringPiece(input.GetData(), input.GetSize());
|
26
26
|
}
|
27
27
|
|
28
28
|
inline string_t Extract(const string_t &input, Vector &result, const RE2 &re, const duckdb_re2::StringPiece &rewrite) {
|
@@ -58,7 +58,7 @@ struct LengthFun {
|
|
58
58
|
|
59
59
|
template <class TA, class TR>
|
60
60
|
static inline TR Length(TA input) {
|
61
|
-
auto input_data = input.
|
61
|
+
auto input_data = input.GetData();
|
62
62
|
auto input_length = input.GetSize();
|
63
63
|
TR length = 0;
|
64
64
|
for (idx_t i = 0; i < input_length; i++) {
|
@@ -69,7 +69,7 @@ struct LengthFun {
|
|
69
69
|
|
70
70
|
template <class TA, class TR>
|
71
71
|
static inline TR GraphemeCount(TA input) {
|
72
|
-
auto input_data = input.
|
72
|
+
auto input_data = input.GetData();
|
73
73
|
auto input_length = input.GetSize();
|
74
74
|
for (idx_t i = 0; i < input_length; i++) {
|
75
75
|
if (input_data[i] & 0x80) {
|
@@ -19,6 +19,9 @@
|
|
19
19
|
namespace duckdb {
|
20
20
|
|
21
21
|
class TableMacroFunction : public MacroFunction {
|
22
|
+
public:
|
23
|
+
static constexpr const MacroType TYPE = MacroType::TABLE_MACRO;
|
24
|
+
|
22
25
|
public:
|
23
26
|
explicit TableMacroFunction(unique_ptr<QueryNode> query_node);
|
24
27
|
TableMacroFunction(void);
|
@@ -80,7 +80,7 @@ struct ToCStringCastWrapper {
|
|
80
80
|
Vector result_vector(LogicalType::VARCHAR, nullptr);
|
81
81
|
auto result_string = OP::template Operation<SOURCE_TYPE>(input, result_vector);
|
82
82
|
auto result_size = result_string.GetSize();
|
83
|
-
auto result_data = result_string.
|
83
|
+
auto result_data = result_string.GetData();
|
84
84
|
|
85
85
|
char *allocated_data = (char *)duckdb_malloc(result_size + 1);
|
86
86
|
memcpy(allocated_data, result_data, result_size);
|
@@ -30,7 +30,7 @@ private:
|
|
30
30
|
//! First iteration: count how many times each expression occurs
|
31
31
|
void CountExpressions(Expression &expr, CSEReplacementState &state);
|
32
32
|
//! Second iteration: perform the actual replacement of the duplicate expressions with common subexpressions nodes
|
33
|
-
void PerformCSEReplacement(unique_ptr<Expression>
|
33
|
+
void PerformCSEReplacement(unique_ptr<Expression> &expr, CSEReplacementState &state);
|
34
34
|
|
35
35
|
//! Main method to extract common subexpressions
|
36
36
|
void ExtractCommonSubExpresions(LogicalOperator &op);
|
@@ -184,6 +184,7 @@ private:
|
|
184
184
|
//! Transform a Postgres duckdb_libpgquery::T_PGSelectStmt node into a QueryNode
|
185
185
|
unique_ptr<QueryNode> TransformSelectNode(duckdb_libpgquery::PGSelectStmt *node);
|
186
186
|
unique_ptr<QueryNode> TransformSelectInternal(duckdb_libpgquery::PGSelectStmt *node);
|
187
|
+
void TransformModifiers(duckdb_libpgquery::PGSelectStmt &stmt, QueryNode &node);
|
187
188
|
|
188
189
|
//===--------------------------------------------------------------------===//
|
189
190
|
// Expression Transform
|
@@ -321,7 +321,7 @@ private:
|
|
321
321
|
|
322
322
|
unique_ptr<LogicalOperator> PlanFilter(unique_ptr<Expression> condition, unique_ptr<LogicalOperator> root);
|
323
323
|
|
324
|
-
void PlanSubqueries(unique_ptr<Expression>
|
324
|
+
void PlanSubqueries(unique_ptr<Expression> &expr, unique_ptr<LogicalOperator> &root);
|
325
325
|
unique_ptr<Expression> PlanSubquery(BoundSubqueryExpression &expr, unique_ptr<LogicalOperator> &root);
|
326
326
|
unique_ptr<LogicalOperator> PlanLateralJoin(unique_ptr<LogicalOperator> left, unique_ptr<LogicalOperator> right,
|
327
327
|
vector<CorrelatedColumnInfo> &correlated_columns,
|
@@ -21,7 +21,7 @@ public:
|
|
21
21
|
AggregateBinder(Binder &binder, ClientContext &context);
|
22
22
|
|
23
23
|
protected:
|
24
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
24
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
25
25
|
bool root_expression = false) override;
|
26
26
|
|
27
27
|
string UnsupportedAggregateMessage() override;
|
@@ -24,7 +24,7 @@ public:
|
|
24
24
|
vector<LogicalIndex> &bound_columns;
|
25
25
|
|
26
26
|
protected:
|
27
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
27
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
28
28
|
bool root_expression = false) override;
|
29
29
|
|
30
30
|
BindResult BindColumn(ColumnRefExpression &expr);
|
@@ -40,10 +40,11 @@ public:
|
|
40
40
|
}
|
41
41
|
|
42
42
|
protected:
|
43
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
43
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
44
44
|
bool root_expression = false) override;
|
45
45
|
|
46
|
-
BindResult BindAggregate(FunctionExpression &expr, AggregateFunctionCatalogEntry
|
46
|
+
BindResult BindAggregate(FunctionExpression &expr, optional_ptr<AggregateFunctionCatalogEntry> function,
|
47
|
+
idx_t depth) override;
|
47
48
|
|
48
49
|
bool inside_window;
|
49
50
|
bool bound_aggregate = false;
|
@@ -53,7 +54,7 @@ protected:
|
|
53
54
|
case_insensitive_map_t<idx_t> alias_map;
|
54
55
|
|
55
56
|
protected:
|
56
|
-
BindResult BindColumnRef(unique_ptr<ParsedExpression>
|
57
|
+
BindResult BindColumnRef(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth);
|
57
58
|
BindResult BindGroupingFunction(OperatorExpression &op, idx_t depth) override;
|
58
59
|
BindResult BindWindow(WindowExpression &expr, idx_t depth);
|
59
60
|
|
@@ -25,7 +25,7 @@ public:
|
|
25
25
|
physical_index_set_t &bound_columns;
|
26
26
|
|
27
27
|
protected:
|
28
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
28
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
29
29
|
bool root_expression = false) override;
|
30
30
|
|
31
31
|
BindResult BindCheckColumn(ColumnRefExpression &expr);
|
@@ -21,7 +21,7 @@ public:
|
|
21
21
|
string clause;
|
22
22
|
|
23
23
|
protected:
|
24
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
24
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr, idx_t depth, bool root_expression = false) override;
|
25
25
|
|
26
26
|
string UnsupportedAggregateMessage() override;
|
27
27
|
};
|
@@ -27,7 +27,7 @@ public:
|
|
27
27
|
idx_t bind_index;
|
28
28
|
|
29
29
|
protected:
|
30
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
30
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) override;
|
31
31
|
|
32
32
|
string UnsupportedAggregateMessage() override;
|
33
33
|
|
@@ -21,11 +21,11 @@ public:
|
|
21
21
|
case_insensitive_map_t<idx_t> &alias_map, AggregateHandling aggregate_handling);
|
22
22
|
|
23
23
|
protected:
|
24
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
24
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
25
25
|
bool root_expression = false) override;
|
26
26
|
|
27
27
|
private:
|
28
|
-
BindResult BindColumnRef(unique_ptr<ParsedExpression>
|
28
|
+
BindResult BindColumnRef(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression);
|
29
29
|
|
30
30
|
ColumnAliasBinder column_alias_binder;
|
31
31
|
AggregateHandling aggregate_handling;
|
@@ -23,7 +23,7 @@ public:
|
|
23
23
|
optional_ptr<CreateIndexInfo> info = nullptr);
|
24
24
|
|
25
25
|
protected:
|
26
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
26
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
27
27
|
bool root_expression = false) override;
|
28
28
|
string UnsupportedAggregateMessage() override;
|
29
29
|
|
@@ -18,7 +18,7 @@ public:
|
|
18
18
|
InsertBinder(Binder &binder, ClientContext &context);
|
19
19
|
|
20
20
|
protected:
|
21
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
21
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
22
22
|
bool root_expression = false) override;
|
23
23
|
|
24
24
|
string UnsupportedAggregateMessage() override;
|
@@ -29,13 +29,13 @@ public:
|
|
29
29
|
static void ReduceExpressionDepth(LogicalOperator &op, const vector<CorrelatedColumnInfo> &info);
|
30
30
|
|
31
31
|
protected:
|
32
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
32
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
33
33
|
bool root_expression = false) override;
|
34
34
|
|
35
35
|
string UnsupportedAggregateMessage() override;
|
36
36
|
|
37
37
|
private:
|
38
|
-
BindResult BindColumnRef(unique_ptr<ParsedExpression>
|
38
|
+
BindResult BindColumnRef(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression);
|
39
39
|
void ExtractCorrelatedColumns(Expression &expr);
|
40
40
|
|
41
41
|
private:
|
@@ -20,11 +20,11 @@ public:
|
|
20
20
|
case_insensitive_map_t<idx_t> &alias_map);
|
21
21
|
|
22
22
|
protected:
|
23
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
23
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
24
24
|
bool root_expression = false) override;
|
25
25
|
|
26
26
|
private:
|
27
|
-
BindResult BindColumnRef(unique_ptr<ParsedExpression>
|
27
|
+
BindResult BindColumnRef(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression);
|
28
28
|
|
29
29
|
ColumnAliasBinder column_alias_binder;
|
30
30
|
};
|
@@ -20,7 +20,7 @@ public:
|
|
20
20
|
string op;
|
21
21
|
|
22
22
|
protected:
|
23
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
23
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
24
24
|
bool root_expression = false) override;
|
25
25
|
|
26
26
|
string UnsupportedAggregateMessage() override;
|
@@ -18,7 +18,7 @@ public:
|
|
18
18
|
ReturningBinder(Binder &binder, ClientContext &context);
|
19
19
|
|
20
20
|
protected:
|
21
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
21
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
22
22
|
bool root_expression = false) override;
|
23
23
|
};
|
24
24
|
|
@@ -19,7 +19,7 @@ public:
|
|
19
19
|
|
20
20
|
protected:
|
21
21
|
BindResult BindColumnReference(ColumnRefExpression &expr, idx_t depth, bool root_expression);
|
22
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
22
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr, idx_t depth, bool root_expression = false) override;
|
23
23
|
|
24
24
|
string UnsupportedAggregateMessage() override;
|
25
25
|
};
|
@@ -18,7 +18,7 @@ public:
|
|
18
18
|
UpdateBinder(Binder &binder, ClientContext &context);
|
19
19
|
|
20
20
|
protected:
|
21
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
21
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
22
22
|
bool root_expression = false) override;
|
23
23
|
|
24
24
|
string UnsupportedAggregateMessage() override;
|
@@ -20,13 +20,13 @@ public:
|
|
20
20
|
WhereBinder(Binder &binder, ClientContext &context, optional_ptr<ColumnAliasBinder> column_alias_binder = nullptr);
|
21
21
|
|
22
22
|
protected:
|
23
|
-
BindResult BindExpression(unique_ptr<ParsedExpression>
|
23
|
+
BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
24
24
|
bool root_expression = false) override;
|
25
25
|
|
26
26
|
string UnsupportedAggregateMessage() override;
|
27
27
|
|
28
28
|
private:
|
29
|
-
BindResult BindColumnRef(unique_ptr<ParsedExpression>
|
29
|
+
BindResult BindColumnRef(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression);
|
30
30
|
|
31
31
|
optional_ptr<ColumnAliasBinder> column_alias_binder;
|
32
32
|
};
|
@@ -63,7 +63,7 @@ public:
|
|
63
63
|
optional_ptr<vector<DummyBinding>> lambda_bindings;
|
64
64
|
|
65
65
|
public:
|
66
|
-
unique_ptr<Expression> Bind(unique_ptr<ParsedExpression> &expr, LogicalType
|
66
|
+
unique_ptr<Expression> Bind(unique_ptr<ParsedExpression> &expr, optional_ptr<LogicalType> result_type = nullptr,
|
67
67
|
bool root_expression = true);
|
68
68
|
|
69
69
|
//! Returns whether or not any columns have been bound by the expression binder
|
@@ -74,7 +74,7 @@ public:
|
|
74
74
|
return bound_columns;
|
75
75
|
}
|
76
76
|
|
77
|
-
string Bind(unique_ptr<ParsedExpression>
|
77
|
+
string Bind(unique_ptr<ParsedExpression> &expr, idx_t depth, bool root_expression = false);
|
78
78
|
|
79
79
|
unique_ptr<ParsedExpression> CreateStructExtract(unique_ptr<ParsedExpression> base, string field_name);
|
80
80
|
unique_ptr<ParsedExpression> CreateStructPack(ColumnRefExpression &colref);
|
@@ -103,7 +103,7 @@ public:
|
|
103
103
|
|
104
104
|
//! Bind the given expresion. Unlike Bind(), this does *not* mute the given ParsedExpression.
|
105
105
|
//! Exposed to be used from sub-binders that aren't subclasses of ExpressionBinder.
|
106
|
-
virtual BindResult BindExpression(unique_ptr<ParsedExpression>
|
106
|
+
virtual BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth,
|
107
107
|
bool root_expression = false);
|
108
108
|
|
109
109
|
void ReplaceMacroParametersRecursive(unique_ptr<ParsedExpression> &expr);
|
@@ -117,7 +117,7 @@ protected:
|
|
117
117
|
BindResult BindExpression(ComparisonExpression &expr, idx_t depth);
|
118
118
|
BindResult BindExpression(ConjunctionExpression &expr, idx_t depth);
|
119
119
|
BindResult BindExpression(ConstantExpression &expr, idx_t depth);
|
120
|
-
BindResult BindExpression(FunctionExpression &expr, idx_t depth, unique_ptr<ParsedExpression>
|
120
|
+
BindResult BindExpression(FunctionExpression &expr, idx_t depth, unique_ptr<ParsedExpression> &expr_ptr);
|
121
121
|
BindResult BindExpression(LambdaExpression &expr, idx_t depth, const bool is_lambda,
|
122
122
|
const LogicalType &list_child_type);
|
123
123
|
BindResult BindExpression(OperatorExpression &expr, idx_t depth);
|
@@ -134,12 +134,15 @@ protected:
|
|
134
134
|
|
135
135
|
protected:
|
136
136
|
virtual BindResult BindGroupingFunction(OperatorExpression &op, idx_t depth);
|
137
|
-
virtual BindResult BindFunction(FunctionExpression &expr, ScalarFunctionCatalogEntry
|
138
|
-
|
139
|
-
virtual BindResult
|
137
|
+
virtual BindResult BindFunction(FunctionExpression &expr, optional_ptr<ScalarFunctionCatalogEntry> function,
|
138
|
+
idx_t depth);
|
139
|
+
virtual BindResult BindLambdaFunction(FunctionExpression &expr, optional_ptr<ScalarFunctionCatalogEntry> function,
|
140
|
+
idx_t depth);
|
141
|
+
virtual BindResult BindAggregate(FunctionExpression &expr, optional_ptr<AggregateFunctionCatalogEntry> function,
|
142
|
+
idx_t depth);
|
140
143
|
virtual BindResult BindUnnest(FunctionExpression &expr, idx_t depth, bool root_expression);
|
141
|
-
virtual BindResult BindMacro(FunctionExpression &expr, ScalarMacroCatalogEntry
|
142
|
-
unique_ptr<ParsedExpression>
|
144
|
+
virtual BindResult BindMacro(FunctionExpression &expr, optional_ptr<ScalarMacroCatalogEntry> macro, idx_t depth,
|
145
|
+
unique_ptr<ParsedExpression> &expr_ptr);
|
143
146
|
|
144
147
|
virtual string UnsupportedAggregateMessage();
|
145
148
|
virtual string UnsupportedUnnestMessage();
|
@@ -155,7 +155,7 @@ public:
|
|
155
155
|
remaining_space -= required_space;
|
156
156
|
auto dict_pos = end - *dictionary_size;
|
157
157
|
// now write the actual string data into the dictionary
|
158
|
-
memcpy(dict_pos, source_data[source_idx].
|
158
|
+
memcpy(dict_pos, source_data[source_idx].GetData(), string_length);
|
159
159
|
|
160
160
|
// place the dictionary offset into the set of vectors
|
161
161
|
result_data[target_idx] = *dictionary_size;
|
@@ -35,7 +35,7 @@ bool CastDecimalCInternal(duckdb_result *source, duckdb_string &result, idx_t co
|
|
35
35
|
throw duckdb::InternalException("Unimplemented internal type for decimal");
|
36
36
|
}
|
37
37
|
result.data = (char *)duckdb_malloc(sizeof(char) * (result_string.GetSize() + 1));
|
38
|
-
memcpy(result.data, result_string.
|
38
|
+
memcpy(result.data, result_string.GetData(), result_string.GetSize());
|
39
39
|
result.data[result_string.GetSize()] = '\0';
|
40
40
|
result.size = result_string.GetSize();
|
41
41
|
return true;
|
@@ -21,7 +21,7 @@ struct CStringConverter {
|
|
21
21
|
static DST Convert(SRC input) {
|
22
22
|
auto result = (char *)duckdb_malloc(input.GetSize() + 1);
|
23
23
|
assert(result);
|
24
|
-
memcpy((void *)result, input.
|
24
|
+
memcpy((void *)result, input.GetData(), input.GetSize());
|
25
25
|
auto write_arr = (char *)result;
|
26
26
|
write_arr[input.GetSize()] = '\0';
|
27
27
|
return result;
|
@@ -40,7 +40,7 @@ struct CBlobConverter {
|
|
40
40
|
result.data = (char *)duckdb_malloc(input.GetSize());
|
41
41
|
result.size = input.GetSize();
|
42
42
|
assert(result.data);
|
43
|
-
memcpy((void *)result.data, input.
|
43
|
+
memcpy((void *)result.data, input.GetData(), input.GetSize());
|
44
44
|
return result;
|
45
45
|
}
|
46
46
|
|
@@ -73,8 +73,8 @@ void CommonSubExpressionOptimizer::CountExpressions(Expression &expr, CSEReplace
|
|
73
73
|
ExpressionIterator::EnumerateChildren(expr, [&](Expression &child) { CountExpressions(child, state); });
|
74
74
|
}
|
75
75
|
|
76
|
-
void CommonSubExpressionOptimizer::PerformCSEReplacement(unique_ptr<Expression>
|
77
|
-
Expression &expr =
|
76
|
+
void CommonSubExpressionOptimizer::PerformCSEReplacement(unique_ptr<Expression> &expr_ptr, CSEReplacementState &state) {
|
77
|
+
Expression &expr = *expr_ptr;
|
78
78
|
if (expr.expression_class == ExpressionClass::BOUND_COLUMN_REF) {
|
79
79
|
auto &bound_column_ref = expr.Cast<BoundColumnRefExpression>();
|
80
80
|
// bound column ref, check if this one has already been recorded in the expression list
|
@@ -105,20 +105,20 @@ void CommonSubExpressionOptimizer::PerformCSEReplacement(unique_ptr<Expression>
|
|
105
105
|
if (node.column_index == DConstants::INVALID_INDEX) {
|
106
106
|
// has not been pushed yet: push it
|
107
107
|
node.column_index = state.expressions.size();
|
108
|
-
state.expressions.push_back(std::move(
|
108
|
+
state.expressions.push_back(std::move(expr_ptr));
|
109
109
|
} else {
|
110
|
-
state.cached_expressions.push_back(std::move(
|
110
|
+
state.cached_expressions.push_back(std::move(expr_ptr));
|
111
111
|
}
|
112
112
|
// replace the original expression with a bound column ref
|
113
|
-
|
114
|
-
|
113
|
+
expr_ptr = make_uniq<BoundColumnRefExpression>(alias, type,
|
114
|
+
ColumnBinding(state.projection_index, node.column_index));
|
115
115
|
return;
|
116
116
|
}
|
117
117
|
}
|
118
118
|
// this expression only occurs once, we can't perform CSE elimination
|
119
119
|
// look into the children to see if we can replace them
|
120
120
|
ExpressionIterator::EnumerateChildren(expr,
|
121
|
-
[&](unique_ptr<Expression> &child) { PerformCSEReplacement(
|
121
|
+
[&](unique_ptr<Expression> &child) { PerformCSEReplacement(child, state); });
|
122
122
|
}
|
123
123
|
|
124
124
|
void CommonSubExpressionOptimizer::ExtractCommonSubExpresions(LogicalOperator &op) {
|
@@ -143,8 +143,9 @@ void CommonSubExpressionOptimizer::ExtractCommonSubExpresions(LogicalOperator &o
|
|
143
143
|
state.projection_index = binder.GenerateTableIndex();
|
144
144
|
// we found common subexpressions to extract
|
145
145
|
// now we iterate over all the expressions and perform the actual CSE elimination
|
146
|
+
|
146
147
|
LogicalOperatorVisitor::EnumerateExpressions(
|
147
|
-
op, [&](unique_ptr<Expression> *child) { PerformCSEReplacement(child, state); });
|
148
|
+
op, [&](unique_ptr<Expression> *child) { PerformCSEReplacement(*child, state); });
|
148
149
|
D_ASSERT(state.expressions.size() > 0);
|
149
150
|
// create a projection node as the child of this node
|
150
151
|
auto projection = make_uniq<LogicalProjection>(state.projection_index, std::move(state.expressions));
|
@@ -77,7 +77,7 @@ unique_ptr<ParsedExpression> SubqueryExpression::Deserialize(ExpressionType type
|
|
77
77
|
void SubqueryExpression::FormatSerialize(FormatSerializer &serializer) const {
|
78
78
|
ParsedExpression::FormatSerialize(serializer);
|
79
79
|
serializer.WriteProperty("subquery_type", subquery_type);
|
80
|
-
serializer.WriteProperty("subquery", *subquery
|
80
|
+
serializer.WriteProperty("subquery", *subquery);
|
81
81
|
serializer.WriteOptionalProperty("child", child);
|
82
82
|
serializer.WriteProperty("comparison_type", comparison_type);
|
83
83
|
}
|
@@ -176,6 +176,8 @@ unique_ptr<QueryNode> Transformer::TransformPivotStatement(duckdb_libpgquery::PG
|
|
176
176
|
}
|
177
177
|
pivot_ref->pivots = std::move(columns);
|
178
178
|
select_node->from_table = std::move(pivot_ref);
|
179
|
+
// transform order by/limit modifiers
|
180
|
+
TransformModifiers(*stmt, *select_node);
|
179
181
|
return std::move(select_node);
|
180
182
|
}
|
181
183
|
|
@@ -8,6 +8,38 @@
|
|
8
8
|
|
9
9
|
namespace duckdb {
|
10
10
|
|
11
|
+
void Transformer::TransformModifiers(duckdb_libpgquery::PGSelectStmt &stmt, QueryNode &node) {
|
12
|
+
// transform the common properties
|
13
|
+
// both the set operations and the regular select can have an ORDER BY/LIMIT attached to them
|
14
|
+
vector<OrderByNode> orders;
|
15
|
+
TransformOrderBy(stmt.sortClause, orders);
|
16
|
+
if (!orders.empty()) {
|
17
|
+
auto order_modifier = make_uniq<OrderModifier>();
|
18
|
+
order_modifier->orders = std::move(orders);
|
19
|
+
node.modifiers.push_back(std::move(order_modifier));
|
20
|
+
}
|
21
|
+
if (stmt.limitCount || stmt.limitOffset) {
|
22
|
+
if (stmt.limitCount && stmt.limitCount->type == duckdb_libpgquery::T_PGLimitPercent) {
|
23
|
+
auto limit_percent_modifier = make_uniq<LimitPercentModifier>();
|
24
|
+
auto expr_node = reinterpret_cast<duckdb_libpgquery::PGLimitPercent *>(stmt.limitCount)->limit_percent;
|
25
|
+
limit_percent_modifier->limit = TransformExpression(expr_node);
|
26
|
+
if (stmt.limitOffset) {
|
27
|
+
limit_percent_modifier->offset = TransformExpression(stmt.limitOffset);
|
28
|
+
}
|
29
|
+
node.modifiers.push_back(std::move(limit_percent_modifier));
|
30
|
+
} else {
|
31
|
+
auto limit_modifier = make_uniq<LimitModifier>();
|
32
|
+
if (stmt.limitCount) {
|
33
|
+
limit_modifier->limit = TransformExpression(stmt.limitCount);
|
34
|
+
}
|
35
|
+
if (stmt.limitOffset) {
|
36
|
+
limit_modifier->offset = TransformExpression(stmt.limitOffset);
|
37
|
+
}
|
38
|
+
node.modifiers.push_back(std::move(limit_modifier));
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
11
43
|
unique_ptr<QueryNode> Transformer::TransformSelectInternal(duckdb_libpgquery::PGSelectStmt *stmt) {
|
12
44
|
D_ASSERT(stmt->type == duckdb_libpgquery::T_PGSelectStmt);
|
13
45
|
auto stack_checker = StackCheck();
|
@@ -119,35 +151,7 @@ unique_ptr<QueryNode> Transformer::TransformSelectInternal(duckdb_libpgquery::PG
|
|
119
151
|
default:
|
120
152
|
throw NotImplementedException("Statement type %d not implemented!", stmt->op);
|
121
153
|
}
|
122
|
-
|
123
|
-
// both the set operations and the regular select can have an ORDER BY/LIMIT attached to them
|
124
|
-
vector<OrderByNode> orders;
|
125
|
-
TransformOrderBy(stmt->sortClause, orders);
|
126
|
-
if (!orders.empty()) {
|
127
|
-
auto order_modifier = make_uniq<OrderModifier>();
|
128
|
-
order_modifier->orders = std::move(orders);
|
129
|
-
node->modifiers.push_back(std::move(order_modifier));
|
130
|
-
}
|
131
|
-
if (stmt->limitCount || stmt->limitOffset) {
|
132
|
-
if (stmt->limitCount && stmt->limitCount->type == duckdb_libpgquery::T_PGLimitPercent) {
|
133
|
-
auto limit_percent_modifier = make_uniq<LimitPercentModifier>();
|
134
|
-
auto expr_node = reinterpret_cast<duckdb_libpgquery::PGLimitPercent *>(stmt->limitCount)->limit_percent;
|
135
|
-
limit_percent_modifier->limit = TransformExpression(expr_node);
|
136
|
-
if (stmt->limitOffset) {
|
137
|
-
limit_percent_modifier->offset = TransformExpression(stmt->limitOffset);
|
138
|
-
}
|
139
|
-
node->modifiers.push_back(std::move(limit_percent_modifier));
|
140
|
-
} else {
|
141
|
-
auto limit_modifier = make_uniq<LimitModifier>();
|
142
|
-
if (stmt->limitCount) {
|
143
|
-
limit_modifier->limit = TransformExpression(stmt->limitCount);
|
144
|
-
}
|
145
|
-
if (stmt->limitOffset) {
|
146
|
-
limit_modifier->offset = TransformExpression(stmt->limitOffset);
|
147
|
-
}
|
148
|
-
node->modifiers.push_back(std::move(limit_modifier));
|
149
|
-
}
|
150
|
-
}
|
154
|
+
TransformModifiers(*stmt, *node);
|
151
155
|
return node;
|
152
156
|
}
|
153
157
|
|