/src/duckdb/src/function/udf_function.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | #include "duckdb/function/udf_function.hpp" |
2 | | |
3 | | #include "duckdb/parser/parsed_data/create_scalar_function_info.hpp" |
4 | | #include "duckdb/parser/parsed_data/create_aggregate_function_info.hpp" |
5 | | |
6 | | #include "duckdb/main/client_context.hpp" |
7 | | |
8 | | namespace duckdb { |
9 | | |
10 | | void UDFWrapper::RegisterFunction(string name, vector<LogicalType> args, LogicalType ret_type, |
11 | 0 | scalar_function_t udf_function, ClientContext &context, LogicalType varargs) { |
12 | |
|
13 | 0 | ScalarFunction scalar_function(move(name), move(args), move(ret_type), move(udf_function)); |
14 | 0 | scalar_function.varargs = move(varargs); |
15 | 0 | scalar_function.null_handling = FunctionNullHandling::SPECIAL_HANDLING; |
16 | 0 | CreateScalarFunctionInfo info(scalar_function); |
17 | 0 | info.schema = DEFAULT_SCHEMA; |
18 | 0 | context.RegisterFunction(&info); |
19 | 0 | } |
20 | | |
21 | 0 | void UDFWrapper::RegisterAggrFunction(AggregateFunction aggr_function, ClientContext &context, LogicalType varargs) { |
22 | 0 | aggr_function.varargs = move(varargs); |
23 | 0 | CreateAggregateFunctionInfo info(move(aggr_function)); |
24 | 0 | context.RegisterFunction(&info); |
25 | 0 | } |
26 | | |
27 | | } // namespace duckdb |