MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / bindFunc

Function bindFunc

src/function/string/concat_ws.cpp:10–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8using namespace lbug::common;
9
10static std::unique_ptr<FunctionBindData> bindFunc(const ScalarBindFuncInput& input) {
11 if (input.arguments.size() < 2) {
12 throw BinderException{std::format("concat_ws expects at least two parameters. Got: {}.",
13 input.arguments.size())};
14 }
15 for (auto i = 0u; i < input.arguments.size(); i++) {
16 auto& argument = input.arguments[i];
17 if (argument->getDataType().getLogicalTypeID() == LogicalTypeID::ANY) {
18 argument->cast(LogicalType::STRING());
19 }
20 if (argument->getDataType() != LogicalType::STRING()) {
21 throw BinderException{std::format("concat_ws expects all string parameters. Got: {}.",
22 argument->getDataType().toString())};
23 }
24 }
25 return FunctionBindData::getSimpleBindData(input.arguments, LogicalType::STRING());
26}
27
28using handle_separator_func_t = std::function<void()>;
29using handle_element_func_t = std::function<void(const string_t&)>;

Callers

nothing calls this directly

Calls 5

getLogicalTypeIDMethod · 0.80
getDataTypeMethod · 0.80
sizeMethod · 0.45
castMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected