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

Function bindFunc

src/function/list/list_prepend_function.cpp:33–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31};
32
33static std::unique_ptr<FunctionBindData> bindFunc(const ScalarBindFuncInput& input) {
34
35 std::vector<LogicalType> types;
36 types.push_back(input.arguments[0]->getDataType().copy());
37 types.push_back(input.arguments[1]->getDataType().copy());
38
39 using resolver = ListTypeResolver<ListOp::Prepend>;
40 ListFunctionUtils::resolveTypes(input, types, resolver::anyEmpty, resolver::anyEmpty,
41 resolver::anyEmpty, resolver::finalResolver, resolver::bothNull, resolver::leftNull,
42 resolver::rightNull, resolver::finalResolver);
43
44 if (types[0].getLogicalTypeID() != LogicalTypeID::ANY &&
45 types[1] != ListType::getChildType(types[0])) {
46 throw BinderException(ExceptionMessage::listFunctionIncompatibleChildrenType(
47 ListAppendFunction::name, types[0].toString(), types[1].toString()));
48 }
49
50 auto scalarFunction = input.definition->ptrCast<ScalarFunction>();
51 TypeUtils::visit(types[1].getPhysicalType(), [&scalarFunction]<typename T>(T) {
52 scalarFunction->execFunc = ScalarFunction::BinaryExecListStructFunction<list_entry_t, T,
53 list_entry_t, ListPrepend>;
54 });
55
56 return std::make_unique<FunctionBindData>(std::move(types), types[0].copy());
57}
58
59function_set ListPrependFunction::getFunctionSet() {
60 function_set result;

Callers

nothing calls this directly

Calls 8

getChildTypeFunction · 0.85
getDataTypeMethod · 0.80
getLogicalTypeIDMethod · 0.80
visitFunction · 0.50
push_backMethod · 0.45
copyMethod · 0.45
toStringMethod · 0.45
getPhysicalTypeMethod · 0.45

Tested by

no test coverage detected