duckdb 0.7.2-dev3515.0 → 0.7.2-dev3666.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/configure.py +2 -0
- package/package.json +1 -1
- package/src/database.cpp +1 -0
- package/src/duckdb/extension/json/buffered_json_reader.cpp +56 -17
- package/src/duckdb/extension/json/include/buffered_json_reader.hpp +56 -31
- package/src/duckdb/extension/json/include/json_common.hpp +5 -4
- package/src/duckdb/extension/json/include/json_executors.hpp +13 -18
- package/src/duckdb/extension/json/include/json_functions.hpp +3 -0
- package/src/duckdb/extension/json/include/json_scan.hpp +106 -153
- package/src/duckdb/extension/json/include/json_transform.hpp +2 -2
- package/src/duckdb/extension/json/json_common.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/copy_json.cpp +94 -38
- package/src/duckdb/extension/json/json_functions/json_contains.cpp +7 -8
- package/src/duckdb/extension/json/json_functions/json_create.cpp +7 -7
- package/src/duckdb/extension/json/json_functions/json_merge_patch.cpp +4 -4
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +4 -4
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +7 -5
- package/src/duckdb/extension/json/json_functions/json_transform.cpp +10 -8
- package/src/duckdb/extension/json/json_functions/json_valid.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/read_json.cpp +167 -169
- package/src/duckdb/extension/json/json_functions/read_json_objects.cpp +37 -16
- package/src/duckdb/extension/json/json_functions.cpp +11 -4
- package/src/duckdb/extension/json/json_scan.cpp +593 -374
- package/src/duckdb/extension/parquet/parquet-extension.cpp +5 -0
- package/src/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp +42 -0
- package/src/duckdb/src/catalog/catalog_search_path.cpp +5 -0
- package/src/duckdb/src/catalog/catalog_set.cpp +1 -1
- package/src/duckdb/src/common/constants.cpp +1 -0
- package/src/duckdb/src/common/file_system.cpp +26 -6
- package/src/duckdb/src/common/local_file_system.cpp +0 -13
- package/src/duckdb/src/common/types/vector.cpp +3 -3
- package/src/duckdb/src/common/types/vector_buffer.cpp +11 -3
- package/src/duckdb/src/common/types/vector_cache.cpp +5 -5
- package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +12 -6
- package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +10 -0
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +2 -2
- package/src/duckdb/src/function/macro_function.cpp +43 -0
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +5 -3
- package/src/duckdb/src/function/scalar/strftime_format.cpp +1 -0
- package/src/duckdb/src/function/scalar_macro_function.cpp +10 -0
- package/src/duckdb/src/function/table/copy_csv.cpp +68 -18
- package/src/duckdb/src/function/table/read_csv.cpp +30 -3
- package/src/duckdb/src/function/table/version/pragma_version.cpp +8 -2
- package/src/duckdb/src/function/table_macro_function.cpp +10 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/column_dependency_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +3 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +0 -6
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +0 -6
- package/src/duckdb/src/include/duckdb/catalog/catalog_search_path.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/similar_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/exception.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/file_system.hpp +5 -0
- package/src/duckdb/src/include/duckdb/common/http_state.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/hugeint.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/limits.hpp +46 -46
- package/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +8 -8
- package/src/duckdb/src/include/duckdb/common/operator/comparison_operators.hpp +6 -6
- package/src/duckdb/src/include/duckdb/common/operator/convert_to_string.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/operator/decimal_cast_operators.hpp +2 -4
- package/src/duckdb/src/include/duckdb/common/operator/string_cast.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/operator/subtract.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/preserved_error.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/re2_regex.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +7 -7
- package/src/duckdb/src/include/duckdb/common/types/chunk_collection.hpp +10 -10
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection.hpp +12 -12
- package/src/duckdb/src/include/duckdb/common/types/column/column_data_collection_iterators.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +12 -2
- package/src/duckdb/src/include/duckdb/common/types.hpp +2 -2
- package/src/duckdb/src/include/duckdb/common/winapi.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +9 -5
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +10 -14
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +7 -1
- package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +3 -4
- package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +7 -2
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +5 -0
- package/src/duckdb/src/include/duckdb/function/udf_function.hpp +56 -50
- package/src/duckdb/src/include/duckdb/main/appender.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +2 -2
- package/src/duckdb/src/include/duckdb/main/client_data.hpp +3 -1
- package/src/duckdb/src/include/duckdb/main/connection.hpp +8 -9
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/query_result.hpp +3 -3
- package/src/duckdb/src/include/duckdb/main/relation.hpp +6 -7
- package/src/duckdb/src/include/duckdb/optimizer/optimizer_extension.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/column_list.hpp +7 -7
- package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +4 -7
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +8 -12
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +6 -20
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +6 -18
- package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +4 -8
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +4 -38
- package/src/duckdb/src/include/duckdb/parser/parsed_data/transaction_info.hpp +5 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +10 -10
- package/src/duckdb/src/include/duckdb/parser/parser_extension.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/sql_statement.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/statement/select_statement.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/operator_extension.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +2 -2
- package/src/duckdb/src/parser/parsed_data/attach_info.cpp +42 -0
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +0 -7
- package/src/duckdb/src/parser/parsed_data/create_info.cpp +19 -8
- package/src/duckdb/src/parser/parsed_data/create_macro_info.cpp +46 -0
- package/src/duckdb/src/parser/parsed_data/create_sequence_info.cpp +56 -0
- package/src/duckdb/src/parser/parsed_data/create_type_info.cpp +47 -0
- package/src/duckdb/src/parser/parsed_data/detach_info.cpp +34 -0
- package/src/duckdb/src/parser/parsed_data/drop_info.cpp +46 -0
- package/src/duckdb/src/parser/parsed_data/transaction_info.cpp +24 -0
- package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +37 -0
- package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +27 -9
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +9 -4
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +2 -1
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +1 -0
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +1 -1
- package/src/duckdb/src/planner/logical_operator.cpp +1 -2
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +16 -25
- package/src/duckdb/src/planner/operator/logical_insert.cpp +30 -0
- package/src/duckdb/src/planner/operator/logical_simple.cpp +33 -5
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +6 -16
- package/src/duckdb/src/planner/planner.cpp +4 -13
- package/src/duckdb/src/storage/checkpoint_manager.cpp +12 -6
- package/src/duckdb/src/storage/single_file_block_manager.cpp +0 -4
- package/src/duckdb/src/storage/storage_info.cpp +1 -1
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +5735 -5773
- package/src/duckdb/ub_src_catalog_catalog_entry.cpp +1 -1
- package/src/duckdb/ub_src_parser_parsed_data.cpp +16 -0
- package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +0 -104
@@ -16,7 +16,7 @@ namespace duckdb {
|
|
16
16
|
struct UDFWrapper {
|
17
17
|
public:
|
18
18
|
template <typename TR, typename... Args>
|
19
|
-
static scalar_function_t CreateScalarFunction(const string &name, TR (*udf_func)(Args...)) {
|
19
|
+
inline static scalar_function_t CreateScalarFunction(const string &name, TR (*udf_func)(Args...)) {
|
20
20
|
const std::size_t num_template_argc = sizeof...(Args);
|
21
21
|
switch (num_template_argc) {
|
22
22
|
case 1:
|
@@ -31,8 +31,8 @@ public:
|
|
31
31
|
}
|
32
32
|
|
33
33
|
template <typename TR, typename... Args>
|
34
|
-
static scalar_function_t CreateScalarFunction(const string &name, vector<LogicalType> args,
|
35
|
-
|
34
|
+
inline static scalar_function_t CreateScalarFunction(const string &name, vector<LogicalType> args,
|
35
|
+
LogicalType ret_type, TR (*udf_func)(Args...)) {
|
36
36
|
if (!TypesMatch<TR>(ret_type)) { // LCOV_EXCL_START
|
37
37
|
throw std::runtime_error("Return type doesn't match with the first template type.");
|
38
38
|
} // LCOV_EXCL_STOP
|
@@ -56,8 +56,8 @@ public:
|
|
56
56
|
}
|
57
57
|
|
58
58
|
template <typename TR, typename... Args>
|
59
|
-
static void RegisterFunction(const string &name, scalar_function_t udf_function, ClientContext &context,
|
60
|
-
|
59
|
+
inline static void RegisterFunction(const string &name, scalar_function_t udf_function, ClientContext &context,
|
60
|
+
LogicalType varargs = LogicalType(LogicalTypeId::INVALID)) {
|
61
61
|
vector<LogicalType> arguments;
|
62
62
|
GetArgumentTypesRecursive<Args...>(arguments);
|
63
63
|
|
@@ -66,23 +66,24 @@ public:
|
|
66
66
|
RegisterFunction(name, arguments, ret_type, udf_function, context, varargs);
|
67
67
|
}
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
static void RegisterFunction(string name, vector<LogicalType> args, LogicalType ret_type,
|
70
|
+
scalar_function_t udf_function, ClientContext &context,
|
71
|
+
LogicalType varargs = LogicalType(LogicalTypeId::INVALID));
|
72
72
|
|
73
73
|
//--------------------------------- Aggregate UDFs ------------------------------------//
|
74
74
|
template <typename UDF_OP, typename STATE, typename TR, typename TA>
|
75
|
-
static AggregateFunction CreateAggregateFunction(const string &name) {
|
75
|
+
inline static AggregateFunction CreateAggregateFunction(const string &name) {
|
76
76
|
return CreateUnaryAggregateFunction<UDF_OP, STATE, TR, TA>(name);
|
77
77
|
}
|
78
78
|
|
79
79
|
template <typename UDF_OP, typename STATE, typename TR, typename TA, typename TB>
|
80
|
-
static AggregateFunction CreateAggregateFunction(const string &name) {
|
80
|
+
inline static AggregateFunction CreateAggregateFunction(const string &name) {
|
81
81
|
return CreateBinaryAggregateFunction<UDF_OP, STATE, TR, TA, TB>(name);
|
82
82
|
}
|
83
83
|
|
84
84
|
template <typename UDF_OP, typename STATE, typename TR, typename TA>
|
85
|
-
static AggregateFunction CreateAggregateFunction(const string &name, LogicalType ret_type,
|
85
|
+
inline static AggregateFunction CreateAggregateFunction(const string &name, LogicalType ret_type,
|
86
|
+
LogicalType input_type) {
|
86
87
|
if (!TypesMatch<TR>(ret_type)) { // LCOV_EXCL_START
|
87
88
|
throw std::runtime_error("The return argument don't match!");
|
88
89
|
} // LCOV_EXCL_STOP
|
@@ -95,8 +96,8 @@ public:
|
|
95
96
|
}
|
96
97
|
|
97
98
|
template <typename UDF_OP, typename STATE, typename TR, typename TA, typename TB>
|
98
|
-
static AggregateFunction CreateAggregateFunction(const string &name, LogicalType ret_type,
|
99
|
-
|
99
|
+
inline static AggregateFunction CreateAggregateFunction(const string &name, LogicalType ret_type,
|
100
|
+
LogicalType input_typeA, LogicalType input_typeB) {
|
100
101
|
if (!TypesMatch<TR>(ret_type)) { // LCOV_EXCL_START
|
101
102
|
throw std::runtime_error("The return argument don't match!");
|
102
103
|
}
|
@@ -113,13 +114,12 @@ public:
|
|
113
114
|
}
|
114
115
|
|
115
116
|
//! A generic CreateAggregateFunction ---------------------------------------------------------------------------//
|
116
|
-
static AggregateFunction
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
aggregate_destructor_t destructor = nullptr) {
|
117
|
+
inline static AggregateFunction
|
118
|
+
CreateAggregateFunction(string name, vector<LogicalType> arguments, LogicalType return_type,
|
119
|
+
aggregate_size_t state_size, aggregate_initialize_t initialize, aggregate_update_t update,
|
120
|
+
aggregate_combine_t combine, aggregate_finalize_t finalize,
|
121
|
+
aggregate_simple_update_t simple_update = nullptr, bind_aggregate_function_t bind = nullptr,
|
122
|
+
aggregate_destructor_t destructor = nullptr) {
|
123
123
|
|
124
124
|
AggregateFunction aggr_function(std::move(name), std::move(arguments), std::move(return_type), state_size,
|
125
125
|
initialize, update, combine, finalize, simple_update, bind, destructor);
|
@@ -127,8 +127,8 @@ public:
|
|
127
127
|
return aggr_function;
|
128
128
|
}
|
129
129
|
|
130
|
-
|
131
|
-
|
130
|
+
static void RegisterAggrFunction(AggregateFunction aggr_function, ClientContext &context,
|
131
|
+
LogicalType varargs = LogicalType(LogicalTypeId::INVALID));
|
132
132
|
|
133
133
|
private:
|
134
134
|
//-------------------------------- Templated functions --------------------------------//
|
@@ -142,7 +142,7 @@ private:
|
|
142
142
|
};
|
143
143
|
|
144
144
|
template <typename TR, typename TA>
|
145
|
-
static scalar_function_t CreateUnaryFunction(const string &name, TR (*udf_func)(TA)) {
|
145
|
+
inline static scalar_function_t CreateUnaryFunction(const string &name, TR (*udf_func)(TA)) {
|
146
146
|
scalar_function_t udf_function = [=](DataChunk &input, ExpressionState &state, Vector &result) -> void {
|
147
147
|
UnaryExecutor::GenericExecute<TA, TR, UnaryUDFExecutor>(input.data[0], result, input.size(),
|
148
148
|
(void *)udf_func);
|
@@ -151,7 +151,7 @@ private:
|
|
151
151
|
}
|
152
152
|
|
153
153
|
template <typename TR, typename TA, typename TB>
|
154
|
-
static scalar_function_t CreateBinaryFunction(const string &name, TR (*udf_func)(TA, TB)) {
|
154
|
+
inline static scalar_function_t CreateBinaryFunction(const string &name, TR (*udf_func)(TA, TB)) {
|
155
155
|
scalar_function_t udf_function = [=](DataChunk &input, ExpressionState &state, Vector &result) -> void {
|
156
156
|
BinaryExecutor::Execute<TA, TB, TR>(input.data[0], input.data[1], result, input.size(), udf_func);
|
157
157
|
};
|
@@ -159,7 +159,7 @@ private:
|
|
159
159
|
}
|
160
160
|
|
161
161
|
template <typename TR, typename TA, typename TB, typename TC>
|
162
|
-
static scalar_function_t CreateTernaryFunction(const string &name, TR (*udf_func)(TA, TB, TC)) {
|
162
|
+
inline static scalar_function_t CreateTernaryFunction(const string &name, TR (*udf_func)(TA, TB, TC)) {
|
163
163
|
scalar_function_t udf_function = [=](DataChunk &input, ExpressionState &state, Vector &result) -> void {
|
164
164
|
TernaryExecutor::Execute<TA, TB, TC, TR>(input.data[0], input.data[1], input.data[2], result, input.size(),
|
165
165
|
udf_func);
|
@@ -168,22 +168,25 @@ private:
|
|
168
168
|
}
|
169
169
|
|
170
170
|
template <typename TR, typename... Args>
|
171
|
-
static scalar_function_t CreateUnaryFunction(const string &name,
|
171
|
+
inline static scalar_function_t CreateUnaryFunction(const string &name,
|
172
|
+
TR (*udf_func)(Args...)) { // LCOV_EXCL_START
|
172
173
|
throw std::runtime_error("Incorrect number of arguments for unary function");
|
173
174
|
} // LCOV_EXCL_STOP
|
174
175
|
|
175
176
|
template <typename TR, typename... Args>
|
176
|
-
static scalar_function_t CreateBinaryFunction(const string &name,
|
177
|
+
inline static scalar_function_t CreateBinaryFunction(const string &name,
|
178
|
+
TR (*udf_func)(Args...)) { // LCOV_EXCL_START
|
177
179
|
throw std::runtime_error("Incorrect number of arguments for binary function");
|
178
180
|
} // LCOV_EXCL_STOP
|
179
181
|
|
180
182
|
template <typename TR, typename... Args>
|
181
|
-
static scalar_function_t CreateTernaryFunction(const string &name,
|
183
|
+
inline static scalar_function_t CreateTernaryFunction(const string &name,
|
184
|
+
TR (*udf_func)(Args...)) { // LCOV_EXCL_START
|
182
185
|
throw std::runtime_error("Incorrect number of arguments for ternary function");
|
183
186
|
} // LCOV_EXCL_STOP
|
184
187
|
|
185
188
|
template <typename T>
|
186
|
-
static LogicalType GetArgumentType() {
|
189
|
+
inline static LogicalType GetArgumentType() {
|
187
190
|
if (std::is_same<T, bool>()) {
|
188
191
|
return LogicalType(LogicalTypeId::BOOLEAN);
|
189
192
|
} else if (std::is_same<T, int8_t>()) {
|
@@ -206,13 +209,13 @@ private:
|
|
206
209
|
}
|
207
210
|
|
208
211
|
template <typename TA, typename TB, typename... Args>
|
209
|
-
static void GetArgumentTypesRecursive(vector<LogicalType> &arguments) {
|
212
|
+
inline static void GetArgumentTypesRecursive(vector<LogicalType> &arguments) {
|
210
213
|
arguments.push_back(GetArgumentType<TA>());
|
211
214
|
GetArgumentTypesRecursive<TB, Args...>(arguments);
|
212
215
|
}
|
213
216
|
|
214
217
|
template <typename TA>
|
215
|
-
static void GetArgumentTypesRecursive(vector<LogicalType> &arguments) {
|
218
|
+
inline static void GetArgumentTypesRecursive(vector<LogicalType> &arguments) {
|
216
219
|
arguments.push_back(GetArgumentType<TA>());
|
217
220
|
}
|
218
221
|
|
@@ -220,14 +223,15 @@ private:
|
|
220
223
|
//-------------------------------- Argumented functions --------------------------------//
|
221
224
|
|
222
225
|
template <typename TR, typename... Args>
|
223
|
-
static scalar_function_t CreateUnaryFunction(const string &name, vector<LogicalType> args,
|
224
|
-
|
226
|
+
inline static scalar_function_t CreateUnaryFunction(const string &name, vector<LogicalType> args,
|
227
|
+
LogicalType ret_type,
|
228
|
+
TR (*udf_func)(Args...)) { // LCOV_EXCL_START
|
225
229
|
throw std::runtime_error("Incorrect number of arguments for unary function");
|
226
230
|
} // LCOV_EXCL_STOP
|
227
231
|
|
228
232
|
template <typename TR, typename TA>
|
229
|
-
static scalar_function_t CreateUnaryFunction(const string &name, vector<LogicalType> args,
|
230
|
-
|
233
|
+
inline static scalar_function_t CreateUnaryFunction(const string &name, vector<LogicalType> args,
|
234
|
+
LogicalType ret_type, TR (*udf_func)(TA)) {
|
231
235
|
if (args.size() != 1) { // LCOV_EXCL_START
|
232
236
|
throw std::runtime_error("The number of LogicalType arguments (\"args\") should be 1!");
|
233
237
|
}
|
@@ -243,14 +247,15 @@ private:
|
|
243
247
|
}
|
244
248
|
|
245
249
|
template <typename TR, typename... Args>
|
246
|
-
static scalar_function_t CreateBinaryFunction(const string &name, vector<LogicalType> args,
|
247
|
-
|
250
|
+
inline static scalar_function_t CreateBinaryFunction(const string &name, vector<LogicalType> args,
|
251
|
+
LogicalType ret_type,
|
252
|
+
TR (*udf_func)(Args...)) { // LCOV_EXCL_START
|
248
253
|
throw std::runtime_error("Incorrect number of arguments for binary function");
|
249
254
|
} // LCOV_EXCL_STOP
|
250
255
|
|
251
256
|
template <typename TR, typename TA, typename TB>
|
252
|
-
static scalar_function_t CreateBinaryFunction(const string &name, vector<LogicalType> args,
|
253
|
-
|
257
|
+
inline static scalar_function_t CreateBinaryFunction(const string &name, vector<LogicalType> args,
|
258
|
+
LogicalType ret_type, TR (*udf_func)(TA, TB)) {
|
254
259
|
if (args.size() != 2) { // LCOV_EXCL_START
|
255
260
|
throw std::runtime_error("The number of LogicalType arguments (\"args\") should be 2!");
|
256
261
|
}
|
@@ -268,14 +273,15 @@ private:
|
|
268
273
|
}
|
269
274
|
|
270
275
|
template <typename TR, typename... Args>
|
271
|
-
static scalar_function_t CreateTernaryFunction(const string &name, vector<LogicalType> args,
|
272
|
-
|
276
|
+
inline static scalar_function_t CreateTernaryFunction(const string &name, vector<LogicalType> args,
|
277
|
+
LogicalType ret_type,
|
278
|
+
TR (*udf_func)(Args...)) { // LCOV_EXCL_START
|
273
279
|
throw std::runtime_error("Incorrect number of arguments for ternary function");
|
274
280
|
} // LCOV_EXCL_STOP
|
275
281
|
|
276
282
|
template <typename TR, typename TA, typename TB, typename TC>
|
277
|
-
static scalar_function_t CreateTernaryFunction(const string &name, vector<LogicalType> args,
|
278
|
-
|
283
|
+
inline static scalar_function_t CreateTernaryFunction(const string &name, vector<LogicalType> args,
|
284
|
+
LogicalType ret_type, TR (*udf_func)(TA, TB, TC)) {
|
279
285
|
if (args.size() != 3) { // LCOV_EXCL_START
|
280
286
|
throw std::runtime_error("The number of LogicalType arguments (\"args\") should be 3!");
|
281
287
|
}
|
@@ -297,7 +303,7 @@ private:
|
|
297
303
|
}
|
298
304
|
|
299
305
|
template <typename T>
|
300
|
-
static bool TypesMatch(const LogicalType &sql_type) {
|
306
|
+
inline static bool TypesMatch(const LogicalType &sql_type) {
|
301
307
|
switch (sql_type.id()) {
|
302
308
|
case LogicalTypeId::BOOLEAN:
|
303
309
|
return std::is_same<T, bool>();
|
@@ -336,15 +342,15 @@ private:
|
|
336
342
|
private:
|
337
343
|
//-------------------------------- Aggregate functions --------------------------------//
|
338
344
|
template <typename UDF_OP, typename STATE, typename TR, typename TA>
|
339
|
-
static AggregateFunction CreateUnaryAggregateFunction(const string &name) {
|
345
|
+
inline static AggregateFunction CreateUnaryAggregateFunction(const string &name) {
|
340
346
|
LogicalType return_type = GetArgumentType<TR>();
|
341
347
|
LogicalType input_type = GetArgumentType<TA>();
|
342
348
|
return CreateUnaryAggregateFunction<UDF_OP, STATE, TR, TA>(name, return_type, input_type);
|
343
349
|
}
|
344
350
|
|
345
351
|
template <typename UDF_OP, typename STATE, typename TR, typename TA>
|
346
|
-
static AggregateFunction CreateUnaryAggregateFunction(const string &name, LogicalType ret_type,
|
347
|
-
|
352
|
+
inline static AggregateFunction CreateUnaryAggregateFunction(const string &name, LogicalType ret_type,
|
353
|
+
LogicalType input_type) {
|
348
354
|
AggregateFunction aggr_function =
|
349
355
|
AggregateFunction::UnaryAggregate<STATE, TR, TA, UDF_OP>(input_type, ret_type);
|
350
356
|
aggr_function.name = name;
|
@@ -352,7 +358,7 @@ private:
|
|
352
358
|
}
|
353
359
|
|
354
360
|
template <typename UDF_OP, typename STATE, typename TR, typename TA, typename TB>
|
355
|
-
static AggregateFunction CreateBinaryAggregateFunction(const string &name) {
|
361
|
+
inline static AggregateFunction CreateBinaryAggregateFunction(const string &name) {
|
356
362
|
LogicalType return_type = GetArgumentType<TR>();
|
357
363
|
LogicalType input_typeA = GetArgumentType<TA>();
|
358
364
|
LogicalType input_typeB = GetArgumentType<TB>();
|
@@ -360,8 +366,8 @@ private:
|
|
360
366
|
}
|
361
367
|
|
362
368
|
template <typename UDF_OP, typename STATE, typename TR, typename TA, typename TB>
|
363
|
-
static AggregateFunction CreateBinaryAggregateFunction(const string &name, LogicalType ret_type,
|
364
|
-
|
369
|
+
inline static AggregateFunction CreateBinaryAggregateFunction(const string &name, LogicalType ret_type,
|
370
|
+
LogicalType input_typeA, LogicalType input_typeB) {
|
365
371
|
AggregateFunction aggr_function =
|
366
372
|
AggregateFunction::BinaryAggregate<STATE, TR, TA, TB, UDF_OP>(input_typeA, input_typeB, ret_type);
|
367
373
|
aggr_function.name = name;
|
@@ -77,10 +77,10 @@ public:
|
|
77
77
|
//! Flush the changes made by the appender and close it. The appender cannot be used after this point
|
78
78
|
DUCKDB_API void Close();
|
79
79
|
|
80
|
-
|
80
|
+
vector<LogicalType> &GetTypes() {
|
81
81
|
return types;
|
82
82
|
}
|
83
|
-
|
83
|
+
idx_t CurrentColumn() {
|
84
84
|
return column;
|
85
85
|
}
|
86
86
|
DUCKDB_API void AppendDataChunk(DataChunk &value);
|
@@ -86,7 +86,7 @@ public:
|
|
86
86
|
TransactionContext transaction;
|
87
87
|
|
88
88
|
public:
|
89
|
-
|
89
|
+
MetaTransaction &ActiveTransaction() {
|
90
90
|
return transaction.ActiveTransaction();
|
91
91
|
}
|
92
92
|
|
@@ -276,7 +276,7 @@ private:
|
|
276
276
|
|
277
277
|
class ClientContextWrapper {
|
278
278
|
public:
|
279
|
-
|
279
|
+
explicit ClientContextWrapper(const shared_ptr<ClientContext> &context)
|
280
280
|
: client_context(context) {
|
281
281
|
|
282
282
|
};
|
@@ -63,7 +63,9 @@ struct ClientData {
|
|
63
63
|
string file_search_path;
|
64
64
|
|
65
65
|
//! The Max Line Length Size of Last Query Executed on a CSV File. (Only used for testing)
|
66
|
-
|
66
|
+
//! FIXME: this should not be done like this
|
67
|
+
bool debug_set_max_line_length = false;
|
68
|
+
idx_t debug_max_line_length = 0;
|
67
69
|
|
68
70
|
public:
|
69
71
|
DUCKDB_API static ClientData &Get(ClientContext &context);
|
@@ -180,8 +180,8 @@ public:
|
|
180
180
|
UDFWrapper::RegisterFunction<TR, Args...>(name, udf_func, *context, std::move(varargs));
|
181
181
|
}
|
182
182
|
|
183
|
-
|
184
|
-
|
183
|
+
void CreateVectorizedFunction(const string &name, vector<LogicalType> args, LogicalType ret_type,
|
184
|
+
scalar_function_t udf_func, LogicalType varargs = LogicalType::INVALID) {
|
185
185
|
UDFWrapper::RegisterFunction(name, std::move(args), std::move(ret_type), udf_func, *context,
|
186
186
|
std::move(varargs));
|
187
187
|
}
|
@@ -214,13 +214,12 @@ public:
|
|
214
214
|
UDFWrapper::RegisterAggrFunction(function, *context);
|
215
215
|
}
|
216
216
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
aggregate_destructor_t destructor = nullptr) {
|
217
|
+
void CreateAggregateFunction(const string &name, vector<LogicalType> arguments, LogicalType return_type,
|
218
|
+
aggregate_size_t state_size, aggregate_initialize_t initialize,
|
219
|
+
aggregate_update_t update, aggregate_combine_t combine, aggregate_finalize_t finalize,
|
220
|
+
aggregate_simple_update_t simple_update = nullptr,
|
221
|
+
bind_aggregate_function_t bind = nullptr,
|
222
|
+
aggregate_destructor_t destructor = nullptr) {
|
224
223
|
AggregateFunction function =
|
225
224
|
UDFWrapper::CreateAggregateFunction(name, arguments, return_type, state_size, initialize, update, combine,
|
226
225
|
finalize, simple_update, bind, destructor);
|
@@ -70,6 +70,7 @@ static constexpr ExtensionEntry EXTENSION_FUNCTIONS[] = {
|
|
70
70
|
{"read_json", "json"},
|
71
71
|
{"read_json_auto", "json"},
|
72
72
|
{"read_json_objects", "json"},
|
73
|
+
{"read_json_objects_auto", "json"},
|
73
74
|
{"read_ndjson", "json"},
|
74
75
|
{"read_ndjson_auto", "json"},
|
75
76
|
{"read_ndjson_objects", "json"},
|
@@ -108,7 +108,7 @@ public:
|
|
108
108
|
//! Fetch() until both results are exhausted. The data in the results will be lost.
|
109
109
|
DUCKDB_API bool Equals(QueryResult &other);
|
110
110
|
|
111
|
-
|
111
|
+
bool TryFetch(unique_ptr<DataChunk> &result, PreservedError &error) {
|
112
112
|
try {
|
113
113
|
result = Fetch();
|
114
114
|
return success;
|
@@ -191,10 +191,10 @@ private:
|
|
191
191
|
};
|
192
192
|
|
193
193
|
public:
|
194
|
-
|
194
|
+
QueryResultIterator begin() {
|
195
195
|
return QueryResultIterator(this);
|
196
196
|
}
|
197
|
-
|
197
|
+
QueryResultIterator end() {
|
198
198
|
return QueryResultIterator(nullptr);
|
199
199
|
}
|
200
200
|
|
@@ -32,12 +32,11 @@ class TableRef;
|
|
32
32
|
|
33
33
|
class Relation : public std::enable_shared_from_this<Relation> {
|
34
34
|
public:
|
35
|
-
|
36
|
-
: context(context), type(type) {
|
35
|
+
Relation(const std::shared_ptr<ClientContext> &context, RelationType type) : context(context), type(type) {
|
37
36
|
}
|
38
|
-
|
37
|
+
Relation(ClientContextWrapper &context, RelationType type) : context(context.GetContext()), type(type) {
|
39
38
|
}
|
40
|
-
|
39
|
+
virtual ~Relation() {
|
41
40
|
}
|
42
41
|
|
43
42
|
ClientContextWrapper context;
|
@@ -70,7 +69,7 @@ public:
|
|
70
69
|
DUCKDB_API unique_ptr<QueryResult> Explain(ExplainType type = ExplainType::EXPLAIN_STANDARD);
|
71
70
|
|
72
71
|
DUCKDB_API virtual unique_ptr<TableRef> GetTableRef();
|
73
|
-
|
72
|
+
virtual bool IsReadOnly() {
|
74
73
|
return true;
|
75
74
|
}
|
76
75
|
|
@@ -154,10 +153,10 @@ public:
|
|
154
153
|
|
155
154
|
public:
|
156
155
|
//! Whether or not the relation inherits column bindings from its child or not, only relevant for binding
|
157
|
-
|
156
|
+
virtual bool InheritsColumnBindings() {
|
158
157
|
return false;
|
159
158
|
}
|
160
|
-
|
159
|
+
virtual Relation *ChildRelation() {
|
161
160
|
return nullptr;
|
162
161
|
}
|
163
162
|
DUCKDB_API vector<shared_ptr<ExternalDependency>> GetAllDependencies();
|
@@ -76,7 +76,7 @@ public:
|
|
76
76
|
// logical iterator
|
77
77
|
class ColumnListIterator {
|
78
78
|
public:
|
79
|
-
|
79
|
+
ColumnListIterator(const ColumnList &list, bool physical) : list(list), physical(physical) {
|
80
80
|
}
|
81
81
|
|
82
82
|
private:
|
@@ -86,7 +86,7 @@ public:
|
|
86
86
|
private:
|
87
87
|
class ColumnLogicalIteratorInternal {
|
88
88
|
public:
|
89
|
-
|
89
|
+
ColumnLogicalIteratorInternal(const ColumnList &list, bool physical, idx_t pos, idx_t end)
|
90
90
|
: list(list), physical(physical), pos(pos), end(end) {
|
91
91
|
}
|
92
92
|
|
@@ -96,14 +96,14 @@ public:
|
|
96
96
|
idx_t end;
|
97
97
|
|
98
98
|
public:
|
99
|
-
|
99
|
+
ColumnLogicalIteratorInternal &operator++() {
|
100
100
|
pos++;
|
101
101
|
return *this;
|
102
102
|
}
|
103
|
-
|
103
|
+
bool operator!=(const ColumnLogicalIteratorInternal &other) const {
|
104
104
|
return pos != other.pos || end != other.end || &list != &other.list;
|
105
105
|
}
|
106
|
-
|
106
|
+
const ColumnDefinition &operator*() const {
|
107
107
|
if (physical) {
|
108
108
|
return list.GetColumn(PhysicalIndex(pos));
|
109
109
|
} else {
|
@@ -117,10 +117,10 @@ public:
|
|
117
117
|
return physical ? list.PhysicalColumnCount() : list.LogicalColumnCount();
|
118
118
|
}
|
119
119
|
|
120
|
-
|
120
|
+
ColumnLogicalIteratorInternal begin() {
|
121
121
|
return ColumnLogicalIteratorInternal(list, physical, 0, Size());
|
122
122
|
}
|
123
|
-
|
123
|
+
ColumnLogicalIteratorInternal end() {
|
124
124
|
return ColumnLogicalIteratorInternal(list, physical, Size(), Size());
|
125
125
|
}
|
126
126
|
};
|
@@ -27,13 +27,10 @@ struct AttachInfo : public ParseInfo {
|
|
27
27
|
unordered_map<string, Value> options;
|
28
28
|
|
29
29
|
public:
|
30
|
-
unique_ptr<AttachInfo> Copy() const
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
result->options = options;
|
35
|
-
return result;
|
36
|
-
}
|
30
|
+
unique_ptr<AttachInfo> Copy() const;
|
31
|
+
|
32
|
+
void Serialize(Serializer &serializer) const;
|
33
|
+
static unique_ptr<ParseInfo> Deserialize(Deserializer &deserializer);
|
37
34
|
};
|
38
35
|
|
39
36
|
} // namespace duckdb
|
@@ -14,22 +14,18 @@
|
|
14
14
|
namespace duckdb {
|
15
15
|
|
16
16
|
struct CreateMacroInfo : public CreateFunctionInfo {
|
17
|
-
CreateMacroInfo()
|
18
|
-
|
19
|
-
|
20
|
-
CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
|
21
|
-
}
|
17
|
+
CreateMacroInfo();
|
18
|
+
CreateMacroInfo(CatalogType type);
|
22
19
|
|
23
20
|
unique_ptr<MacroFunction> function;
|
24
21
|
|
25
22
|
public:
|
26
|
-
unique_ptr<CreateInfo> Copy() const override
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
}
|
23
|
+
unique_ptr<CreateInfo> Copy() const override;
|
24
|
+
|
25
|
+
DUCKDB_API static unique_ptr<CreateMacroInfo> Deserialize(Deserializer &deserializer);
|
26
|
+
|
27
|
+
protected:
|
28
|
+
void SerializeInternal(Serializer &) const override;
|
33
29
|
};
|
34
30
|
|
35
31
|
} // namespace duckdb
|
@@ -29,10 +29,7 @@ enum class SequenceInfo : uint8_t {
|
|
29
29
|
};
|
30
30
|
|
31
31
|
struct CreateSequenceInfo : public CreateInfo {
|
32
|
-
CreateSequenceInfo()
|
33
|
-
: CreateInfo(CatalogType::SEQUENCE_ENTRY, INVALID_SCHEMA), name(string()), usage_count(0), increment(1),
|
34
|
-
min_value(1), max_value(NumericLimits<int64_t>::Maximum()), start_value(1), cycle(false) {
|
35
|
-
}
|
32
|
+
CreateSequenceInfo();
|
36
33
|
|
37
34
|
//! Sequence name to create
|
38
35
|
string name;
|
@@ -50,24 +47,13 @@ struct CreateSequenceInfo : public CreateInfo {
|
|
50
47
|
bool cycle;
|
51
48
|
|
52
49
|
public:
|
53
|
-
unique_ptr<CreateInfo> Copy() const override
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
result->schema = schema;
|
58
|
-
result->usage_count = usage_count;
|
59
|
-
result->increment = increment;
|
60
|
-
result->min_value = min_value;
|
61
|
-
result->max_value = max_value;
|
62
|
-
result->start_value = start_value;
|
63
|
-
result->cycle = cycle;
|
64
|
-
return std::move(result);
|
65
|
-
}
|
50
|
+
unique_ptr<CreateInfo> Copy() const override;
|
51
|
+
|
52
|
+
public:
|
53
|
+
DUCKDB_API static unique_ptr<CreateSequenceInfo> Deserialize(Deserializer &deserializer);
|
66
54
|
|
67
55
|
protected:
|
68
|
-
void SerializeInternal(Serializer &) const override
|
69
|
-
throw NotImplementedException("Cannot serialize '%s'", CatalogTypeToString(type));
|
70
|
-
}
|
56
|
+
void SerializeInternal(Serializer &) const override;
|
71
57
|
};
|
72
58
|
|
73
59
|
} // namespace duckdb
|
@@ -16,11 +16,8 @@
|
|
16
16
|
namespace duckdb {
|
17
17
|
|
18
18
|
struct CreateTypeInfo : public CreateInfo {
|
19
|
-
CreateTypeInfo()
|
20
|
-
|
21
|
-
CreateTypeInfo(string name_p, LogicalType type_p)
|
22
|
-
: CreateInfo(CatalogType::TYPE_ENTRY), name(std::move(name_p)), type(std::move(type_p)) {
|
23
|
-
}
|
19
|
+
CreateTypeInfo();
|
20
|
+
CreateTypeInfo(string name_p, LogicalType type_p);
|
24
21
|
|
25
22
|
//! Name of the Type
|
26
23
|
string name;
|
@@ -30,21 +27,12 @@ struct CreateTypeInfo : public CreateInfo {
|
|
30
27
|
unique_ptr<SQLStatement> query;
|
31
28
|
|
32
29
|
public:
|
33
|
-
unique_ptr<CreateInfo> Copy() const override
|
34
|
-
|
35
|
-
|
36
|
-
result->name = name;
|
37
|
-
result->type = type;
|
38
|
-
if (query) {
|
39
|
-
result->query = query->Copy();
|
40
|
-
}
|
41
|
-
return std::move(result);
|
42
|
-
}
|
30
|
+
unique_ptr<CreateInfo> Copy() const override;
|
31
|
+
|
32
|
+
DUCKDB_API static unique_ptr<CreateTypeInfo> Deserialize(Deserializer &deserializer);
|
43
33
|
|
44
34
|
protected:
|
45
|
-
void SerializeInternal(Serializer &) const override
|
46
|
-
throw NotImplementedException("Cannot serialize '%s'", CatalogTypeToString(CreateInfo::type));
|
47
|
-
}
|
35
|
+
void SerializeInternal(Serializer &) const override;
|
48
36
|
};
|
49
37
|
|
50
38
|
} // namespace duckdb
|
@@ -14,8 +14,7 @@
|
|
14
14
|
namespace duckdb {
|
15
15
|
|
16
16
|
struct DetachInfo : public ParseInfo {
|
17
|
-
DetachInfo()
|
18
|
-
}
|
17
|
+
DetachInfo();
|
19
18
|
|
20
19
|
//! The alias of the attached database
|
21
20
|
string name;
|
@@ -23,11 +22,8 @@ struct DetachInfo : public ParseInfo {
|
|
23
22
|
OnEntryNotFound if_not_found;
|
24
23
|
|
25
24
|
public:
|
26
|
-
unique_ptr<DetachInfo> Copy() const
|
27
|
-
|
28
|
-
|
29
|
-
result->if_not_found = if_not_found;
|
30
|
-
return result;
|
31
|
-
}
|
25
|
+
unique_ptr<DetachInfo> Copy() const;
|
26
|
+
void Serialize(Serializer &serializer) const;
|
27
|
+
static unique_ptr<ParseInfo> Deserialize(Deserializer &deserializer);
|
32
28
|
};
|
33
29
|
} // namespace duckdb
|