From e2f581adcb05715457e8c5d2c1b05225d8a69a49 Mon Sep 17 00:00:00 2001 From: xiyang Date: Mon, 23 Dec 2024 18:55:35 +0800 Subject: [PATCH 1/3] Refactor scalar function constructor --- .../creation_functions/json_array.cpp | 3 +- .../creation_functions/json_merge_patch.cpp | 6 +- .../creation_functions/json_object.cpp | 3 +- .../functions/creation_functions/to_json.cpp | 6 +- .../extract_functions/json_extract.cpp | 19 ++++-- .../functions/scalar_functions/json_keys.cpp | 7 ++- .../scalar_functions/json_minify.cpp | 7 ++- src/function/array/array_functions.cpp | 13 ++-- src/function/array/array_value.cpp | 3 +- src/function/list/list_agg_function.cpp | 14 +++-- src/function/list/list_all.cpp | 4 +- src/function/list/list_any.cpp | 4 +- src/function/list/list_any_value_function.cpp | 7 ++- src/function/list/list_append_function.cpp | 7 ++- src/function/list/list_concat_function.cpp | 6 +- src/function/list/list_contains_function.cpp | 7 ++- src/function/list/list_creation.cpp | 3 +- src/function/list/list_distinct_function.cpp | 7 ++- src/function/list/list_extract_function.cpp | 20 ++++--- src/function/list/list_filter.cpp | 3 +- src/function/list/list_has_all.cpp | 3 +- src/function/list/list_none.cpp | 4 +- src/function/list/list_position_function.cpp | 9 +-- src/function/list/list_prepend_function.cpp | 7 ++- src/function/list/list_range_function.cpp | 14 +++-- src/function/list/list_reduce.cpp | 3 +- src/function/list/list_reverse_function.cpp | 6 +- src/function/list/list_single.cpp | 4 +- src/function/list/list_slice_function.cpp | 15 +++-- src/function/list/list_sort_function.cpp | 35 +++++++---- src/function/list/list_transform.cpp | 3 +- src/function/list/list_unique_function.cpp | 7 ++- src/function/map/map_creation_function.cpp | 6 +- src/function/map/map_extract_function.cpp | 7 ++- src/function/map/map_keys_function.cpp | 7 ++- src/function/map/map_values_function.cpp | 7 ++- src/function/path/nodes_function.cpp | 8 ++- src/function/path/properties_function.cpp | 7 ++- src/function/path/rels_function.cpp | 8 ++- src/function/path/semantic_function.cpp | 14 +++-- src/function/string/split_part.cpp | 7 ++- src/function/string/string_split_function.cpp | 7 ++- .../struct/struct_extract_function.cpp | 8 ++- src/function/struct/struct_pack_function.cpp | 4 +- src/function/union/union_extract_function.cpp | 8 ++- src/function/union/union_tag_function.cpp | 7 ++- src/function/union/union_value_function.cpp | 8 ++- src/function/utility/coalesce.cpp | 9 ++- src/function/utility/constant_or_null.cpp | 6 +- src/function/utility/typeof.cpp | 7 ++- src/function/vector_arithmetic_functions.cpp | 60 ++++++++++++------- src/function/vector_blob_functions.cpp | 3 +- src/function/vector_cast_functions.cpp | 7 ++- src/function/vector_string_functions.cpp | 37 +++++++----- .../comparison/vector_comparison_functions.h | 7 ++- src/include/function/function.h | 9 ++- src/include/function/scalar_function.h | 37 +++--------- 57 files changed, 322 insertions(+), 232 deletions(-) diff --git a/extension/json/src/functions/creation_functions/json_array.cpp b/extension/json/src/functions/creation_functions/json_array.cpp index 4d81c0728d1..2ab8eacb45f 100644 --- a/extension/json/src/functions/creation_functions/json_array.cpp +++ b/extension/json/src/functions/creation_functions/json_array.cpp @@ -42,7 +42,8 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set JsonArrayFunction::getFunctionSet() { function_set result; auto function = std::make_unique(name, - std::vector{LogicalTypeID::ANY}, LogicalTypeID::STRING, execFunc, bindFunc); + std::vector{LogicalTypeID::ANY}, LogicalTypeID::STRING, execFunc); + function->bindFunc = bindFunc; function->isVarLength = true; result.push_back(std::move(function)); return result; diff --git a/extension/json/src/functions/creation_functions/json_merge_patch.cpp b/extension/json/src/functions/creation_functions/json_merge_patch.cpp index 1e59a877855..6c2521ffd91 100644 --- a/extension/json/src/functions/creation_functions/json_merge_patch.cpp +++ b/extension/json/src/functions/creation_functions/json_merge_patch.cpp @@ -39,9 +39,11 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set JsonMergePatchFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, + auto func = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::STRING}, - LogicalTypeID::STRING, execFunc, bindFunc)); + LogicalTypeID::STRING, execFunc); + func->bindFunc = bindFunc; + result.push_back(std::move(func)); return result; } diff --git a/extension/json/src/functions/creation_functions/json_object.cpp b/extension/json/src/functions/creation_functions/json_object.cpp index 837bec2c7fe..52f6d0b899a 100644 --- a/extension/json/src/functions/creation_functions/json_object.cpp +++ b/extension/json/src/functions/creation_functions/json_object.cpp @@ -54,7 +54,8 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set JsonObjectFunction::getFunctionSet() { function_set result; auto function = std::make_unique(name, - std::vector{LogicalTypeID::ANY}, LogicalTypeID::STRING, execFunc, bindFunc); + std::vector{LogicalTypeID::ANY}, LogicalTypeID::STRING, execFunc); + function->bindFunc = bindFunc; function->isVarLength = true; result.push_back(std::move(function)); return result; diff --git a/extension/json/src/functions/creation_functions/to_json.cpp b/extension/json/src/functions/creation_functions/to_json.cpp index 5dd46d3f351..02eb9ca427e 100644 --- a/extension/json/src/functions/creation_functions/to_json.cpp +++ b/extension/json/src/functions/creation_functions/to_json.cpp @@ -36,8 +36,10 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set ToJsonFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, - std::vector{LogicalTypeID::ANY}, LogicalTypeID::STRING, execFunc, bindFunc)); + auto func = std::make_unique(name, + std::vector{LogicalTypeID::ANY}, LogicalTypeID::STRING, execFunc); + func->bindFunc = bindFunc; + result.push_back(std::move(func)); return result; } diff --git a/extension/json/src/functions/extract_functions/json_extract.cpp b/extension/json/src/functions/extract_functions/json_extract.cpp index 60ffd805a8e..463d6e76b09 100644 --- a/extension/json/src/functions/extract_functions/json_extract.cpp +++ b/extension/json/src/functions/extract_functions/json_extract.cpp @@ -89,15 +89,22 @@ static std::unique_ptr bindJsonExtractMultiPath(ScalarBindFunc function_set JsonExtractFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, + std::unique_ptr func; + func = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::STRING}, - LogicalTypeID::STRING, jsonExtractSinglePath, bindJsonExtractSinglePath)); - result.push_back(std::make_unique(name, + LogicalTypeID::STRING, jsonExtractSinglePath); + func->bindFunc = bindJsonExtractSinglePath; + result.push_back(std::move(func)); + func = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::INT64}, - LogicalTypeID::STRING, jsonExtractSinglePath, bindJsonExtractSinglePath)); - result.push_back(std::make_unique(name, + LogicalTypeID::STRING, jsonExtractSinglePath); + func->bindFunc = bindJsonExtractSinglePath; + result.push_back(std::move(func)); + func = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::LIST}, LogicalTypeID::LIST, - jsonExtractMultiPath, bindJsonExtractMultiPath)); + jsonExtractMultiPath); + func->bindFunc = bindJsonExtractMultiPath; + result.push_back(std::move(func)); return result; } diff --git a/extension/json/src/functions/scalar_functions/json_keys.cpp b/extension/json/src/functions/scalar_functions/json_keys.cpp index 2daae924b1c..f306a628734 100644 --- a/extension/json/src/functions/scalar_functions/json_keys.cpp +++ b/extension/json/src/functions/scalar_functions/json_keys.cpp @@ -50,9 +50,10 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set JsonKeysFunction::getFunctionSet() { function_set result; - result.push_back( - std::make_unique(name, std::vector{LogicalTypeID::STRING}, - LogicalTypeID::LIST, execFunc, bindFunc)); + auto func = std::make_unique(name, std::vector{LogicalTypeID::STRING}, + LogicalTypeID::LIST, execFunc); + func->bindFunc = bindFunc; + result.push_back(std::move(func)); return result; } diff --git a/extension/json/src/functions/scalar_functions/json_minify.cpp b/extension/json/src/functions/scalar_functions/json_minify.cpp index ab33c5aad3e..a93c2cb6990 100644 --- a/extension/json/src/functions/scalar_functions/json_minify.cpp +++ b/extension/json/src/functions/scalar_functions/json_minify.cpp @@ -38,9 +38,10 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set MinifyJsonFunction::getFunctionSet() { function_set result; - result.push_back( - std::make_unique(name, std::vector{LogicalTypeID::STRING}, - LogicalTypeID::STRING, execFunc, bindFunc)); + auto func = std::make_unique(name, std::vector{LogicalTypeID::STRING}, + LogicalTypeID::STRING, execFunc); + func->bindFunc = bindFunc; + result.push_back(std::move(func)); return result; } diff --git a/src/function/array/array_functions.cpp b/src/function/array/array_functions.cpp index d4376156ce9..e175ee9eab0 100644 --- a/src/function/array/array_functions.cpp +++ b/src/function/array/array_functions.cpp @@ -73,12 +73,14 @@ std::unique_ptr ArrayCrossProductBindFunc(ScalarBindFuncInput function_set ArrayCrossProductFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, + auto func = std::make_unique(name, std::vector{ LogicalTypeID::ARRAY, LogicalTypeID::ARRAY, }, - LogicalTypeID::ARRAY, nullptr, nullptr, ArrayCrossProductBindFunc)); + LogicalTypeID::ARRAY); + func->bindFunc = ArrayCrossProductBindFunc; + result.push_back(std::move(func)); return result; } @@ -166,13 +168,14 @@ std::unique_ptr arrayTemplateBindFunc(std::string functionName template function_set templateGetFunctionSet(const std::string& functionName) { function_set result; - result.push_back(std::make_unique(functionName, + auto function = std::make_unique(functionName, std::vector{ LogicalTypeID::ARRAY, LogicalTypeID::ARRAY, }, - LogicalTypeID::ANY, nullptr, nullptr, - std::bind(arrayTemplateBindFunc, functionName, std::placeholders::_1))); + LogicalTypeID::ANY); + function->bindFunc = std::bind(arrayTemplateBindFunc, functionName, std::placeholders::_1); + result.push_back(std::move(function)); return result; } diff --git a/src/function/array/array_value.cpp b/src/function/array/array_value.cpp index aa5f30d3b3a..e1bde6a7905 100644 --- a/src/function/array/array_value.cpp +++ b/src/function/array/array_value.cpp @@ -27,7 +27,8 @@ function_set ArrayValueFunction::getFunctionSet() { function_set result; auto function = std::make_unique(name, std::vector{LogicalTypeID::ANY}, - LogicalTypeID::ARRAY, ListCreationFunction::execFunc, nullptr, bindFunc); + LogicalTypeID::ARRAY, ListCreationFunction::execFunc); + function->bindFunc = bindFunc; function->isVarLength = true; result.push_back(std::move(function)); return result; diff --git a/src/function/list/list_agg_function.cpp b/src/function/list/list_agg_function.cpp index ce3c944025b..cb3e265686a 100644 --- a/src/function/list/list_agg_function.cpp +++ b/src/function/list/list_agg_function.cpp @@ -42,9 +42,10 @@ struct ListSum { function_set ListSumFunction::getFunctionSet() { function_set result; - result.push_back( - std::make_unique(name, std::vector{LogicalTypeID::LIST}, - LogicalTypeID::INT64, bindFuncListAggr)); + auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST}, + LogicalTypeID::INT64); + function->bindFunc = bindFuncListAggr; + result.push_back(std::move(function)); return result; } @@ -65,9 +66,10 @@ struct ListProduct { function_set ListProductFunction::getFunctionSet() { function_set result; - result.push_back( - std::make_unique(name, std::vector{LogicalTypeID::LIST}, - LogicalTypeID::INT64, bindFuncListAggr)); + auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST}, + LogicalTypeID::INT64); + function->bindFunc = bindFuncListAggr; + result.push_back(std::move(function)); return result; } diff --git a/src/function/list/list_all.cpp b/src/function/list/list_all.cpp index fe47dc6d481..127635f8ab6 100644 --- a/src/function/list/list_all.cpp +++ b/src/function/list/list_all.cpp @@ -15,8 +15,8 @@ function_set ListAllFunction::getFunctionSet() { auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::BOOL, std::bind(execQuantifierFunc, allHandler, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3), - bindQuantifierFunc); + std::placeholders::_3)); + function->bindFunc = bindQuantifierFunc; function->isListLambda = true; result.push_back(std::move(function)); return result; diff --git a/src/function/list/list_any.cpp b/src/function/list/list_any.cpp index 812e84689af..23d5a6665f3 100644 --- a/src/function/list/list_any.cpp +++ b/src/function/list/list_any.cpp @@ -15,8 +15,8 @@ function_set ListAnyFunction::getFunctionSet() { auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::BOOL, std::bind(execQuantifierFunc, anyHandler, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3), - bindQuantifierFunc); + std::placeholders::_3)); + function->bindFunc = bindQuantifierFunc; function->isListLambda = true; result.push_back(std::move(function)); return result; diff --git a/src/function/list/list_any_value_function.cpp b/src/function/list/list_any_value_function.cpp index 3ac064ee561..15bb8486be3 100644 --- a/src/function/list/list_any_value_function.cpp +++ b/src/function/list/list_any_value_function.cpp @@ -38,9 +38,10 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set ListAnyValueFunction::getFunctionSet() { function_set result; - result.push_back( - std::make_unique(name, std::vector{LogicalTypeID::LIST}, - LogicalTypeID::ANY, nullptr, nullptr, bindFunc)); + auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST}, + LogicalTypeID::ANY); + function->bindFunc = bindFunc; + result.push_back(std::move(function)); return result; } diff --git a/src/function/list/list_append_function.cpp b/src/function/list/list_append_function.cpp index f566b0738c5..64f32fa362f 100644 --- a/src/function/list/list_append_function.cpp +++ b/src/function/list/list_append_function.cpp @@ -49,9 +49,10 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set ListAppendFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, - std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::LIST, - nullptr /* execFunc */, nullptr /* selectFunc */, bindFunc)); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::LIST); + function->bindFunc = bindFunc; + result.push_back(std::move(function)); return result; } diff --git a/src/function/list/list_concat_function.cpp b/src/function/list/list_concat_function.cpp index ac7fc245eaa..938b8a2d8e6 100644 --- a/src/function/list/list_concat_function.cpp +++ b/src/function/list/list_concat_function.cpp @@ -41,9 +41,11 @@ function_set ListConcatFunction::getFunctionSet() { function_set result; auto execFunc = ScalarFunction::BinaryExecListStructFunction; - result.push_back(std::make_unique(name, + auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::LIST}, LogicalTypeID::LIST, - execFunc, nullptr, bindFunc)); + execFunc); + function->bindFunc = bindFunc; + result.push_back(std::move(function)); return result; } diff --git a/src/function/list/list_contains_function.cpp b/src/function/list/list_contains_function.cpp index fb535f585c8..7b696c01fed 100644 --- a/src/function/list/list_contains_function.cpp +++ b/src/function/list/list_contains_function.cpp @@ -46,9 +46,10 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set ListContainsFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, - std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::BOOL, - nullptr, nullptr, bindFunc)); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::BOOL); + function->bindFunc = bindFunc; + result.push_back(std::move(function)); return result; } diff --git a/src/function/list/list_creation.cpp b/src/function/list/list_creation.cpp index 87f68ca3a41..96a5c9dc33c 100644 --- a/src/function/list/list_creation.cpp +++ b/src/function/list/list_creation.cpp @@ -44,7 +44,8 @@ function_set ListCreationFunction::getFunctionSet() { function_set result; auto function = std::make_unique(name, std::vector{LogicalTypeID::ANY}, - LogicalTypeID::LIST, execFunc, nullptr, bindFunc); + LogicalTypeID::LIST, execFunc); + function->bindFunc = bindFunc; function->isVarLength = true; result.push_back(std::move(function)); return result; diff --git a/src/function/list/list_distinct_function.cpp b/src/function/list/list_distinct_function.cpp index 60a1e40fa50..ad652735fce 100644 --- a/src/function/list/list_distinct_function.cpp +++ b/src/function/list/list_distinct_function.cpp @@ -31,10 +31,11 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set ListDistinctFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, + auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST}, LogicalTypeID::LIST, - ScalarFunction::UnaryExecNestedTypeFunction, - nullptr, bindFunc)); + ScalarFunction::UnaryExecNestedTypeFunction); + function->bindFunc = bindFunc; + result.push_back(std::move(function)); return result; } diff --git a/src/function/list/list_extract_function.cpp b/src/function/list/list_extract_function.cpp index 9d638ce2acd..8ec479bcc35 100644 --- a/src/function/list/list_extract_function.cpp +++ b/src/function/list/list_extract_function.cpp @@ -31,16 +31,20 @@ static std::unique_ptr ListExtractBindFunc(ScalarBindFuncInput function_set ListExtractFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, - std::vector{LogicalTypeID::LIST, LogicalTypeID::INT64}, LogicalTypeID::ANY, - nullptr, nullptr, ListExtractBindFunc)); - result.push_back(std::make_unique(name, + std::unique_ptr func; + func = std::make_unique(name, + std::vector{LogicalTypeID::LIST, LogicalTypeID::INT64}, LogicalTypeID::ANY); + func->bindFunc = ListExtractBindFunc; + result.push_back(std::move(func)); + func = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::INT64}, LogicalTypeID::STRING, - ScalarFunction::BinaryExecFunction)); - result.push_back(std::make_unique(name, - std::vector{LogicalTypeID::ARRAY, LogicalTypeID::INT64}, LogicalTypeID::ANY, - nullptr, nullptr, ListExtractBindFunc)); + ScalarFunction::BinaryExecFunction); + result.push_back(std::move(func)); + func = std::make_unique(name, + std::vector{LogicalTypeID::ARRAY, LogicalTypeID::INT64}, LogicalTypeID::ANY); + func->bindFunc = ListExtractBindFunc; + result.push_back(std::move(func)); return result; } diff --git a/src/function/list/list_filter.cpp b/src/function/list/list_filter.cpp index 355e6911c34..c41ef6d3f8d 100644 --- a/src/function/list/list_filter.cpp +++ b/src/function/list/list_filter.cpp @@ -85,7 +85,8 @@ function_set ListFilterFunction::getFunctionSet() { function_set result; auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::LIST, - execFunc, bindFunc); + execFunc); + function->bindFunc = bindFunc; function->isListLambda = true; result.push_back(std::move(function)); return result; diff --git a/src/function/list/list_has_all.cpp b/src/function/list/list_has_all.cpp index 52e126af4f8..55514ed75e5 100644 --- a/src/function/list/list_has_all.cpp +++ b/src/function/list/list_has_all.cpp @@ -58,7 +58,8 @@ function_set ListHasAllFunction::getFunctionSet() { uint8_t, ListHasAll>; auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::LIST}, LogicalTypeID::BOOL, - execFunc, bindFunc); + execFunc); + function->bindFunc = bindFunc; result.push_back(std::move(function)); return result; } diff --git a/src/function/list/list_none.cpp b/src/function/list/list_none.cpp index 9820c49e1a6..df77114ad01 100644 --- a/src/function/list/list_none.cpp +++ b/src/function/list/list_none.cpp @@ -15,8 +15,8 @@ function_set ListNoneFunction::getFunctionSet() { auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::BOOL, std::bind(execQuantifierFunc, noneHandler, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3), - bindQuantifierFunc); + std::placeholders::_3)); + function->bindFunc = bindQuantifierFunc; function->isListLambda = true; result.push_back(std::move(function)); return result; diff --git a/src/function/list/list_position_function.cpp b/src/function/list/list_position_function.cpp index 844816462a5..aa963e88e65 100644 --- a/src/function/list/list_position_function.cpp +++ b/src/function/list/list_position_function.cpp @@ -9,7 +9,7 @@ using namespace kuzu::common; namespace kuzu { namespace function { -static std::unique_ptr ListPositionBindFunc(ScalarBindFuncInput input) { +static std::unique_ptr bindFunc(ScalarBindFuncInput input) { auto scalarFunction = input.definition->ptrCast(); TypeUtils::visit(input.arguments[1]->getDataType().getPhysicalType(), [&scalarFunction](T) { @@ -21,9 +21,10 @@ static std::unique_ptr ListPositionBindFunc(ScalarBindFuncInpu function_set ListPositionFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, - std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::INT64, - ListPositionBindFunc)); + auto func = std::make_unique(name, + std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::INT64); + func->bindFunc = bindFunc; + result.push_back(std::move(func)); return result; } diff --git a/src/function/list/list_prepend_function.cpp b/src/function/list/list_prepend_function.cpp index 240664f9268..0fefc3040a8 100644 --- a/src/function/list/list_prepend_function.cpp +++ b/src/function/list/list_prepend_function.cpp @@ -47,9 +47,10 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set ListPrependFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, - std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::LIST, - bindFunc)); + auto func = std::make_unique(name, + std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::LIST); + func->bindFunc = bindFunc; + result.push_back(std::move(func)); return result; } diff --git a/src/function/list/list_range_function.cpp b/src/function/list/list_range_function.cpp index 77d72787f23..415ddd0222c 100644 --- a/src/function/list/list_range_function.cpp +++ b/src/function/list/list_range_function.cpp @@ -85,15 +85,19 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set ListRangeFunction::getFunctionSet() { function_set result; + std::unique_ptr func; for (auto typeID : LogicalTypeUtils::getIntegerTypeIDs()) { // start, end - result.push_back( - std::make_unique(name, std::vector{typeID, typeID}, - LogicalTypeID::LIST, getBinaryExecFunc(LogicalType{typeID}), bindFunc)); + func = std::make_unique(name, std::vector{typeID, typeID}, + LogicalTypeID::LIST, getBinaryExecFunc(LogicalType{typeID})); + func->bindFunc = bindFunc; + result.push_back(std::move(func)); // start, end, step - result.push_back(std::make_unique(name, + func = std::make_unique(name, std::vector{typeID, typeID, typeID}, LogicalTypeID::LIST, - getTernaryExecFunc(LogicalType{typeID}), bindFunc)); + getTernaryExecFunc(LogicalType{typeID})); + func->bindFunc = bindFunc; + result.push_back(std::move(func)); } return result; } diff --git a/src/function/list/list_reduce.cpp b/src/function/list/list_reduce.cpp index f85e2ead7cb..81dc243590e 100644 --- a/src/function/list/list_reduce.cpp +++ b/src/function/list/list_reduce.cpp @@ -73,7 +73,8 @@ function_set ListReduceFunction::getFunctionSet() { function_set result; auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::LIST, - execFunc, bindFunc); + execFunc); + function->bindFunc = bindFunc; function->isListLambda = true; result.push_back(std::move(function)); return result; diff --git a/src/function/list/list_reverse_function.cpp b/src/function/list/list_reverse_function.cpp index 12847d79204..75406faabfa 100644 --- a/src/function/list/list_reverse_function.cpp +++ b/src/function/list/list_reverse_function.cpp @@ -30,8 +30,10 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set ListReverseFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, - std::vector{LogicalTypeID::LIST}, LogicalTypeID::ANY, bindFunc)); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::LIST}, LogicalTypeID::ANY); + function->bindFunc = bindFunc; + result.push_back(std::move(function)); return result; } diff --git a/src/function/list/list_single.cpp b/src/function/list/list_single.cpp index 2ebbba56e30..6fbdb129fbe 100644 --- a/src/function/list/list_single.cpp +++ b/src/function/list/list_single.cpp @@ -15,8 +15,8 @@ function_set ListSingleFunction::getFunctionSet() { auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::BOOL, std::bind(execQuantifierFunc, singleHandler, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3), - bindQuantifierFunc); + std::placeholders::_3)); + function->bindFunc = bindQuantifierFunc; function->isListLambda = true; result.push_back(std::move(function)); return result; diff --git a/src/function/list/list_slice_function.cpp b/src/function/list/list_slice_function.cpp index 10b16c4e1c8..78ea036b879 100644 --- a/src/function/list/list_slice_function.cpp +++ b/src/function/list/list_slice_function.cpp @@ -70,19 +70,22 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set ListSliceFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, + std::unique_ptr func; + func = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::INT64, LogicalTypeID::INT64}, LogicalTypeID::LIST, ScalarFunction::TernaryExecListStructFunction, - nullptr /* selectFunc */, bindFunc)); - result.push_back(std::make_unique(name, + ListSlice>); + func->bindFunc = bindFunc; + result.push_back(std::move(func)); + func = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::INT64, LogicalTypeID::INT64}, LogicalTypeID::STRING, ScalarFunction::TernaryExecListStructFunction, - nullptr /* selectFunc */, bindFunc)); + ListSlice>); + func->bindFunc = bindFunc; + result.push_back(std::move(func)); return result; } diff --git a/src/function/list/list_sort_function.cpp b/src/function/list/list_sort_function.cpp index aabe10df7a5..651a47ebbd6 100644 --- a/src/function/list/list_sort_function.cpp +++ b/src/function/list/list_sort_function.cpp @@ -57,26 +57,35 @@ static std::unique_ptr ListReverseSortBindFunc(ScalarBindFuncI function_set ListSortFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, - std::vector{LogicalTypeID::LIST}, LogicalTypeID::LIST, ListSortBindFunc)); - result.push_back(std::make_unique(name, - std::vector{LogicalTypeID::LIST, LogicalTypeID::STRING}, LogicalTypeID::LIST, - ListSortBindFunc)); - result.push_back(std::make_unique(name, + std::unique_ptr func; + func = std::make_unique(name, + std::vector{LogicalTypeID::LIST}, LogicalTypeID::LIST); + func->bindFunc = ListSortBindFunc; + result.push_back(std::move(func)); + func = std::make_unique(name, + std::vector{LogicalTypeID::LIST, LogicalTypeID::STRING}, LogicalTypeID::LIST); + func->bindFunc = ListSortBindFunc; + result.push_back(std::move(func)); + func = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::STRING, LogicalTypeID::STRING}, - LogicalTypeID::LIST, ListSortBindFunc)); + LogicalTypeID::LIST); + func->bindFunc = ListSortBindFunc; + result.push_back(std::move(func)); return result; } function_set ListReverseSortFunction::getFunctionSet() { function_set result; - result.push_back( - std::make_unique(name, std::vector{LogicalTypeID::LIST}, - LogicalTypeID::LIST, ListReverseSortBindFunc)); - result.push_back(std::make_unique(name, - std::vector{LogicalTypeID::LIST, LogicalTypeID::STRING}, LogicalTypeID::LIST, - ListReverseSortBindFunc)); + std::unique_ptr func; + func = std::make_unique(name, std::vector{LogicalTypeID::LIST}, + LogicalTypeID::LIST); + func->bindFunc = ListReverseSortBindFunc; + result.push_back(std::move(func)); + func = std::make_unique(name, + std::vector{LogicalTypeID::LIST, LogicalTypeID::STRING}, LogicalTypeID::LIST); + func->bindFunc = ListReverseSortBindFunc; + result.push_back(std::move(func)); return result; } diff --git a/src/function/list/list_transform.cpp b/src/function/list/list_transform.cpp index 2e29cd9d82d..4a4dfc16b6c 100644 --- a/src/function/list/list_transform.cpp +++ b/src/function/list/list_transform.cpp @@ -61,7 +61,8 @@ function_set ListTransformFunction::getFunctionSet() { function_set result; auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::ANY}, LogicalTypeID::LIST, - execFunc, bindFunc); + execFunc); + function->bindFunc = bindFunc; function->isListLambda = true; result.push_back(std::move(function)); return result; diff --git a/src/function/list/list_unique_function.cpp b/src/function/list/list_unique_function.cpp index 2119f0577e0..9cd0c2b2220 100644 --- a/src/function/list/list_unique_function.cpp +++ b/src/function/list/list_unique_function.cpp @@ -46,10 +46,11 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set ListUniqueFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, + auto func = std::make_unique(name, std::vector{LogicalTypeID::LIST}, LogicalTypeID::INT64, - ScalarFunction::UnaryExecNestedTypeFunction, nullptr, - bindFunc)); + ScalarFunction::UnaryExecNestedTypeFunction); + func->bindFunc = bindFunc; + result.push_back(std::move(func)); return result; } diff --git a/src/function/map/map_creation_function.cpp b/src/function/map/map_creation_function.cpp index 7fc17747f97..2c027806bf1 100644 --- a/src/function/map/map_creation_function.cpp +++ b/src/function/map/map_creation_function.cpp @@ -19,9 +19,11 @@ function_set MapCreationFunctions::getFunctionSet() { auto execFunc = ScalarFunction::BinaryExecMapCreationFunction; function_set functionSet; - functionSet.push_back(make_unique(name, + auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::LIST}, LogicalTypeID::MAP, - execFunc, nullptr, bindFunc)); + execFunc); + function->bindFunc = bindFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/map/map_extract_function.cpp b/src/function/map/map_extract_function.cpp index d44ee6bbee1..9dfe81fe660 100644 --- a/src/function/map/map_extract_function.cpp +++ b/src/function/map/map_extract_function.cpp @@ -31,9 +31,10 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set MapExtractFunctions::getFunctionSet() { function_set functionSet; - functionSet.push_back(make_unique(name, - std::vector{LogicalTypeID::MAP, LogicalTypeID::ANY}, LogicalTypeID::LIST, - nullptr, nullptr, bindFunc)); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::MAP, LogicalTypeID::ANY}, LogicalTypeID::LIST); + function->bindFunc = bindFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/map/map_keys_function.cpp b/src/function/map/map_keys_function.cpp index 2ff4da1189c..e85ba99b042 100644 --- a/src/function/map/map_keys_function.cpp +++ b/src/function/map/map_keys_function.cpp @@ -17,9 +17,10 @@ function_set MapKeysFunctions::getFunctionSet() { auto execFunc = ScalarFunction::UnaryExecNestedTypeFunction; function_set functionSet; - functionSet.push_back( - make_unique(name, std::vector{LogicalTypeID::MAP}, - LogicalTypeID::LIST, execFunc, nullptr, bindFunc)); + auto function = std::make_unique(name, std::vector{LogicalTypeID::MAP}, + LogicalTypeID::LIST, execFunc); + function->bindFunc = bindFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/map/map_values_function.cpp b/src/function/map/map_values_function.cpp index 7b4b332e0b1..b964f75a3b8 100644 --- a/src/function/map/map_values_function.cpp +++ b/src/function/map/map_values_function.cpp @@ -17,9 +17,10 @@ function_set MapValuesFunctions::getFunctionSet() { auto execFunc = ScalarFunction::UnaryExecNestedTypeFunction; function_set functionSet; - functionSet.push_back( - make_unique(name, std::vector{LogicalTypeID::MAP}, - LogicalTypeID::LIST, execFunc, nullptr, bindFunc)); + auto function = std::make_unique(name, std::vector{LogicalTypeID::MAP}, + LogicalTypeID::LIST, execFunc); + function->bindFunc = bindFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/path/nodes_function.cpp b/src/function/path/nodes_function.cpp index 29a6d882c88..01f4826f4d4 100644 --- a/src/function/path/nodes_function.cpp +++ b/src/function/path/nodes_function.cpp @@ -20,9 +20,11 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set NodesFunction::getFunctionSet() { function_set functionSet; - functionSet.push_back( - make_unique(name, std::vector{LogicalTypeID::RECURSIVE_REL}, - LogicalTypeID::ANY, nullptr, nullptr, StructExtractFunctions::compileFunc, bindFunc)); + auto function = std::make_unique(name, std::vector{LogicalTypeID::RECURSIVE_REL}, + LogicalTypeID::ANY); + function->bindFunc = bindFunc; + function->compileFunc = StructExtractFunctions::compileFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/path/properties_function.cpp b/src/function/path/properties_function.cpp index a619f4e0da8..159e3232d70 100644 --- a/src/function/path/properties_function.cpp +++ b/src/function/path/properties_function.cpp @@ -56,9 +56,12 @@ static void execFunc(const std::vector>& parameters function_set PropertiesFunction::getFunctionSet() { function_set functions; - functions.push_back(make_unique(name, + auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::STRING}, LogicalTypeID::ANY, - execFunc, nullptr, compileFunc, bindFunc)); + execFunc); + function->bindFunc = bindFunc; + function->compileFunc = compileFunc; + functions.push_back(std::move(function)); return functions; } diff --git a/src/function/path/rels_function.cpp b/src/function/path/rels_function.cpp index f5d9a8b7c24..5351ae65aa1 100644 --- a/src/function/path/rels_function.cpp +++ b/src/function/path/rels_function.cpp @@ -20,9 +20,11 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set RelsFunction::getFunctionSet() { function_set functionSet; - functionSet.push_back( - make_unique(name, std::vector{LogicalTypeID::RECURSIVE_REL}, - LogicalTypeID::ANY, nullptr, nullptr, StructExtractFunctions::compileFunc, bindFunc)); + auto function = std::make_unique(name, std::vector{LogicalTypeID::RECURSIVE_REL}, + LogicalTypeID::ANY); + function->bindFunc = bindFunc; + function->compileFunc = StructExtractFunctions::compileFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/path/semantic_function.cpp b/src/function/path/semantic_function.cpp index 1faf4a61b92..7dff9b4e016 100644 --- a/src/function/path/semantic_function.cpp +++ b/src/function/path/semantic_function.cpp @@ -25,9 +25,10 @@ static bool IsTrailSelectFunc(const std::vector>& p function_set IsTrailFunction::getFunctionSet() { function_set functionSet; - functionSet.push_back( - make_unique(name, std::vector{LogicalTypeID::RECURSIVE_REL}, - LogicalTypeID::BOOL, IsTrailExecFunc, IsTrailSelectFunc, nullptr, bindFunc)); + auto function = std::make_unique(name, std::vector{LogicalTypeID::RECURSIVE_REL}, + LogicalTypeID::BOOL, IsTrailExecFunc, IsTrailSelectFunc); + function->bindFunc = bindFunc; + functionSet.push_back(std::move(function)); return functionSet; } @@ -43,9 +44,10 @@ static bool IsACyclicSelectFunc(const std::vector>& function_set IsACyclicFunction::getFunctionSet() { function_set functionSet; - functionSet.push_back( - make_unique(name, std::vector{LogicalTypeID::RECURSIVE_REL}, - LogicalTypeID::BOOL, IsACyclicExecFunc, IsACyclicSelectFunc, nullptr, bindFunc)); + auto function = std::make_unique(name, std::vector{LogicalTypeID::RECURSIVE_REL}, + LogicalTypeID::BOOL, IsACyclicExecFunc, IsACyclicSelectFunc); + function->bindFunc = bindFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/string/split_part.cpp b/src/function/string/split_part.cpp index 1f0e55db3cd..a5bf4b7524f 100644 --- a/src/function/string/split_part.cpp +++ b/src/function/string/split_part.cpp @@ -22,13 +22,14 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set SplitPartFunction::getFunctionSet() { function_set functionSet; - functionSet.emplace_back(make_unique(name, + auto function = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::STRING, LogicalTypeID::INT64}, LogicalTypeID::STRING, ScalarFunction::TernaryStringExecFunction, - bindFunc)); + SplitPart>); + function->bindFunc = bindFunc; + functionSet.emplace_back(std::move(function)); return functionSet; } diff --git a/src/function/string/string_split_function.cpp b/src/function/string/string_split_function.cpp index 595c3dc7781..e2a689c83d2 100644 --- a/src/function/string/string_split_function.cpp +++ b/src/function/string/string_split_function.cpp @@ -24,12 +24,13 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set StringSplitFunction::getFunctionSet() { function_set functionSet; - functionSet.emplace_back(make_unique(name, + auto function = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::STRING}, LogicalTypeID::LIST, ScalarFunction::BinaryStringExecFunction, - bindFunc)); + StringSplit>); + function->bindFunc = bindFunc; + functionSet.emplace_back(std::move(function)); return functionSet; } diff --git a/src/function/struct/struct_extract_function.cpp b/src/function/struct/struct_extract_function.cpp index ab1f46ada7d..7ce330db272 100644 --- a/src/function/struct/struct_extract_function.cpp +++ b/src/function/struct/struct_extract_function.cpp @@ -39,9 +39,11 @@ void StructExtractFunctions::compileFunc(FunctionBindData* bindData, } static std::unique_ptr getStructExtractFunction(LogicalTypeID logicalTypeID) { - return std::make_unique(StructExtractFunctions::name, - std::vector{logicalTypeID, LogicalTypeID::STRING}, LogicalTypeID::ANY, - nullptr, nullptr, StructExtractFunctions::compileFunc, StructExtractFunctions::bindFunc); + auto function = std::make_unique(StructExtractFunctions::name, + std::vector{logicalTypeID, LogicalTypeID::STRING}, LogicalTypeID::ANY); + function->bindFunc = StructExtractFunctions::bindFunc; + function->compileFunc = StructExtractFunctions::compileFunc; + return function; } function_set StructExtractFunctions::getFunctionSet() { diff --git a/src/function/struct/struct_pack_function.cpp b/src/function/struct/struct_pack_function.cpp index 2e47842239c..73939bb1932 100644 --- a/src/function/struct/struct_pack_function.cpp +++ b/src/function/struct/struct_pack_function.cpp @@ -109,7 +109,9 @@ function_set StructPackFunctions::getFunctionSet() { function_set functions; auto function = std::make_unique(name, std::vector{LogicalTypeID::ANY}, - LogicalTypeID::STRUCT, execFunc, nullptr, compileFunc, bindFunc); + LogicalTypeID::STRUCT, execFunc); + function->bindFunc = bindFunc; + function->compileFunc = compileFunc; function->isVarLength = true; functions.push_back(std::move(function)); return functions; diff --git a/src/function/union/union_extract_function.cpp b/src/function/union/union_extract_function.cpp index 7ec70bc3bea..2cb2fa32045 100644 --- a/src/function/union/union_extract_function.cpp +++ b/src/function/union/union_extract_function.cpp @@ -9,9 +9,11 @@ namespace function { function_set UnionExtractFunction::getFunctionSet() { function_set functionSet; - functionSet.push_back(make_unique(name, - std::vector{LogicalTypeID::UNION, LogicalTypeID::STRING}, LogicalTypeID::ANY, - nullptr, nullptr, StructExtractFunctions::compileFunc, StructExtractFunctions::bindFunc)); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::UNION, LogicalTypeID::STRING}, LogicalTypeID::ANY); + function->bindFunc = StructExtractFunctions::bindFunc; + function->compileFunc = StructExtractFunctions::compileFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/union/union_tag_function.cpp b/src/function/union/union_tag_function.cpp index 32dbab72242..17aeb8d7ab3 100644 --- a/src/function/union/union_tag_function.cpp +++ b/src/function/union/union_tag_function.cpp @@ -13,10 +13,11 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set UnionTagFunction::getFunctionSet() { function_set functionSet; - functionSet.push_back(make_unique(name, + auto function = std::make_unique(name, std::vector{LogicalTypeID::UNION}, LogicalTypeID::STRING, - ScalarFunction::UnaryExecNestedTypeFunction, nullptr, - bindFunc)); + ScalarFunction::UnaryExecNestedTypeFunction); + function->bindFunc = bindFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/union/union_value_function.cpp b/src/function/union/union_value_function.cpp index 0e18ca036c3..b8cbdbfcdc1 100644 --- a/src/function/union/union_value_function.cpp +++ b/src/function/union/union_value_function.cpp @@ -33,9 +33,11 @@ static void valueCompileFunc(FunctionBindData* /*bindData*/, function_set UnionValueFunction::getFunctionSet() { function_set functionSet; - functionSet.push_back( - make_unique(name, std::vector{LogicalTypeID::ANY}, - LogicalTypeID::UNION, execFunc, nullptr, valueCompileFunc, bindFunc)); + auto function = std::make_unique(name, std::vector{LogicalTypeID::ANY}, + LogicalTypeID::UNION, execFunc); + function->bindFunc = bindFunc; + function->compileFunc = valueCompileFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/utility/coalesce.cpp b/src/function/utility/coalesce.cpp index ae0e58b60b2..591b8985987 100644 --- a/src/function/utility/coalesce.cpp +++ b/src/function/utility/coalesce.cpp @@ -76,7 +76,8 @@ function_set CoalesceFunction::getFunctionSet() { function_set functionSet; auto function = std::make_unique(name, std::vector{LogicalTypeID::ANY}, - LogicalTypeID::ANY, execFunc, selectFunc, bindFunc); + LogicalTypeID::ANY, execFunc, selectFunc); + function->bindFunc = bindFunc; function->isVarLength = true; functionSet.push_back(std::move(function)); return functionSet; @@ -84,9 +85,11 @@ function_set CoalesceFunction::getFunctionSet() { function_set IfNullFunction::getFunctionSet() { function_set functionSet; - functionSet.push_back(std::make_unique(name, + auto function = std::make_unique(name, std::vector{LogicalTypeID::ANY, LogicalTypeID::ANY}, LogicalTypeID::ANY, - execFunc, selectFunc, bindFunc)); + execFunc, selectFunc); + function->bindFunc = bindFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/utility/constant_or_null.cpp b/src/function/utility/constant_or_null.cpp index d5e44351d77..ec814cddaac 100644 --- a/src/function/utility/constant_or_null.cpp +++ b/src/function/utility/constant_or_null.cpp @@ -70,9 +70,11 @@ static bool selectFunc(const std::vector>& params, function_set ConstantOrNullFunction::getFunctionSet() { function_set functionSet; - functionSet.push_back(std::make_unique(name, + auto function = std::make_unique(name, std::vector{LogicalTypeID::ANY, LogicalTypeID::ANY}, LogicalTypeID::ANY, - execFunc, selectFunc, bindFunc)); + execFunc, selectFunc); + function->bindFunc = bindFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/utility/typeof.cpp b/src/function/utility/typeof.cpp index b08082f49fb..ca63b7fd4d0 100644 --- a/src/function/utility/typeof.cpp +++ b/src/function/utility/typeof.cpp @@ -31,9 +31,10 @@ static void execFunc(const std::vector>&, ValueVect function_set TypeOfFunction::getFunctionSet() { function_set functionSet; - functionSet.push_back( - std::make_unique(name, std::vector{LogicalTypeID::ANY}, - LogicalTypeID::STRING, execFunc, nullptr /* selectFunc */, bindFunc)); + auto function = std::make_unique(name, std::vector{LogicalTypeID::ANY}, + LogicalTypeID::STRING, execFunc); + function->bindFunc = bindFunc; + functionSet.push_back(std::move(function)); return functionSet; } diff --git a/src/function/vector_arithmetic_functions.cpp b/src/function/vector_arithmetic_functions.cpp index 57189244d68..df9513c0aff 100644 --- a/src/function/vector_arithmetic_functions.cpp +++ b/src/function/vector_arithmetic_functions.cpp @@ -173,15 +173,19 @@ function_set AddFunction::getFunctionSet() { } // decimal + decimal -> decimal - result.push_back(std::make_unique(name, + std::unique_ptr func; + func = std::make_unique(name, std::vector{LogicalTypeID::DECIMAL, LogicalTypeID::DECIMAL}, - LogicalTypeID::DECIMAL, nullptr, nullptr, DecimalFunction::bindAddFunc)); + LogicalTypeID::DECIMAL); + func->bindFunc = DecimalFunction::bindAddFunc; + result.push_back(std::move(func)); // list + list -> list - result.push_back(std::make_unique(name, + func = std::make_unique(name, std::vector{LogicalTypeID::LIST, LogicalTypeID::LIST}, LogicalTypeID::LIST, ScalarFunction::BinaryExecListStructFunction, - nullptr, ListConcatFunction::bindFunc)); + ListConcat>); + func->bindFunc = ListConcatFunction::bindFunc; + result.push_back(std::move(func)); // string + string -> string result.push_back(std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::STRING}, @@ -224,9 +228,11 @@ function_set SubtractFunction::getFunctionSet() { result.push_back(getBinaryFunction(name, typeID)); } // decimal - decimal -> decimal - result.push_back(make_unique(name, + auto func = std::make_unique(name, std::vector{LogicalTypeID::DECIMAL, LogicalTypeID::DECIMAL}, - LogicalTypeID::DECIMAL, nullptr, nullptr, DecimalFunction::bindSubtractFunc)); + LogicalTypeID::DECIMAL); + func->bindFunc = DecimalFunction::bindSubtractFunc; + result.push_back(std::move(func)); // date - date → int64 result.push_back(getBinaryFunction(name, LogicalTypeID::DATE, LogicalTypeID::INT64)); @@ -259,9 +265,11 @@ function_set MultiplyFunction::getFunctionSet() { result.push_back(getBinaryFunction(name, typeID)); } // decimal * decimal -> decimal - result.push_back(make_unique(name, + auto func = std::make_unique(name, std::vector{LogicalTypeID::DECIMAL, LogicalTypeID::DECIMAL}, - LogicalTypeID::DECIMAL, nullptr, nullptr, DecimalFunction::bindMultiplyFunc)); + LogicalTypeID::DECIMAL); + func->bindFunc = DecimalFunction::bindMultiplyFunc; + result.push_back(std::move(func)); return result; } @@ -289,9 +297,11 @@ function_set ModuloFunction::getFunctionSet() { result.push_back(getBinaryFunction(name, typeID)); } // decimal % decimal -> decimal - result.push_back(make_unique(name, + auto func = std::make_unique(name, std::vector{LogicalTypeID::DECIMAL, LogicalTypeID::DECIMAL}, - LogicalTypeID::DECIMAL, nullptr, nullptr, DecimalFunction::bindModuloFunc)); + LogicalTypeID::DECIMAL); + func->bindFunc = DecimalFunction::bindModuloFunc; + result.push_back(std::move(func)); return result; } @@ -309,9 +319,10 @@ function_set NegateFunction::getFunctionSet() { result.push_back(getUnaryFunction(name, typeID)); } // floor(decimal) -> decimal - result.push_back( - make_unique(name, std::vector{LogicalTypeID::DECIMAL}, - LogicalTypeID::DECIMAL, nullptr, nullptr, DecimalFunction::bindNegateFunc)); + auto func = std::make_unique(name, std::vector{LogicalTypeID::DECIMAL}, + LogicalTypeID::DECIMAL); + func->bindFunc = DecimalFunction::bindNegateFunc; + result.push_back(std::move(func)); return result; } @@ -320,9 +331,10 @@ function_set AbsFunction::getFunctionSet() { for (auto& typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) { result.push_back(getUnaryFunction(name, typeID)); } - result.push_back( - make_unique(name, std::vector{LogicalTypeID::DECIMAL}, - LogicalTypeID::DECIMAL, nullptr, nullptr, DecimalFunction::bindAbsFunc)); + auto func = std::make_unique(name, std::vector{LogicalTypeID::DECIMAL}, + LogicalTypeID::DECIMAL); + func->bindFunc = DecimalFunction::bindAbsFunc; + result.push_back(std::move(func)); return result; } @@ -331,9 +343,10 @@ function_set FloorFunction::getFunctionSet() { for (auto& typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) { result.push_back(getUnaryFunction(name, typeID)); } - result.push_back( - make_unique(name, std::vector{LogicalTypeID::DECIMAL}, - LogicalTypeID::DECIMAL, nullptr, nullptr, DecimalFunction::bindFloorFunc)); + auto func = std::make_unique(name, std::vector{LogicalTypeID::DECIMAL}, + LogicalTypeID::DECIMAL); + func->bindFunc = DecimalFunction::bindFloorFunc; + result.push_back(std::move(func)); return result; } @@ -342,9 +355,10 @@ function_set CeilFunction::getFunctionSet() { for (auto& typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) { result.push_back(getUnaryFunction(name, typeID)); } - result.push_back( - make_unique(name, std::vector{LogicalTypeID::DECIMAL}, - LogicalTypeID::DECIMAL, nullptr, nullptr, DecimalFunction::bindCeilFunc)); + auto func = std::make_unique(name, std::vector{LogicalTypeID::DECIMAL}, + LogicalTypeID::DECIMAL); + func->bindFunc = DecimalFunction::bindCeilFunc; + result.push_back(std::move(func)); return result; } diff --git a/src/function/vector_blob_functions.cpp b/src/function/vector_blob_functions.cpp index 740ad184407..674b4093542 100644 --- a/src/function/vector_blob_functions.cpp +++ b/src/function/vector_blob_functions.cpp @@ -14,8 +14,7 @@ function_set OctetLengthFunctions::getFunctionSet() { function_set definitions; definitions.push_back( make_unique(name, std::vector{LogicalTypeID::BLOB}, - LogicalTypeID::INT64, ScalarFunction::UnaryExecFunction, - nullptr, nullptr, nullptr)); + LogicalTypeID::INT64, ScalarFunction::UnaryExecFunction)); return definitions; } diff --git a/src/function/vector_cast_functions.cpp b/src/function/vector_cast_functions.cpp index 9df48ec707b..04b1fd9c10b 100644 --- a/src/function/vector_cast_functions.cpp +++ b/src/function/vector_cast_functions.cpp @@ -1090,9 +1090,10 @@ static std::unique_ptr castBindFunc(ScalarBindFuncInput input) function_set CastAnyFunction::getFunctionSet() { function_set result; - result.push_back(std::make_unique(name, - std::vector{LogicalTypeID::ANY, LogicalTypeID::STRING}, LogicalTypeID::ANY, - nullptr, nullptr, castBindFunc)); + auto func = std::make_unique(name, + std::vector{LogicalTypeID::ANY, LogicalTypeID::STRING}, LogicalTypeID::ANY); + func->bindFunc = castBindFunc; + result.push_back(std::move(func)); return result; } diff --git a/src/function/vector_string_functions.cpp b/src/function/vector_string_functions.cpp index efa32cd9b1a..86aac1f8a7e 100644 --- a/src/function/vector_string_functions.cpp +++ b/src/function/vector_string_functions.cpp @@ -279,20 +279,23 @@ function_set RegexpReplaceFunction::getFunctionSet() { function_set functionSet; // Todo: Implement a function with modifiers // regexp_replace(string, regex, replacement, modifiers) - functionSet.emplace_back(make_unique(name, + std::unique_ptr func; + func = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::STRING, LogicalTypeID::STRING, LogicalTypeID::STRING}, LogicalTypeID::STRING, ScalarFunction::TernaryRegexExecFunction, - regexReplaceBindFunc)); - functionSet.emplace_back(make_unique(name, + RegexpReplace>); + func->bindFunc = regexReplaceBindFunc; + functionSet.emplace_back(std::move(func)); + func = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::STRING, LogicalTypeID::STRING}, LogicalTypeID::STRING, ScalarFunction::TernaryRegexExecFunction, - regexReplaceBindFunc)); + RegexpReplace>); + func->bindFunc = regexReplaceBindFunc; + functionSet.emplace_back(std::move(func)); return functionSet; } @@ -318,30 +321,34 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput /* input * function_set RegexpExtractAllFunction::getFunctionSet() { function_set functionSet; - functionSet.emplace_back(make_unique(name, + std::unique_ptr func; + func = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::STRING}, LogicalTypeID::LIST, ScalarFunction::BinaryStringExecFunction, - nullptr, bindFunc)); - functionSet.emplace_back(make_unique(name, + RegexpExtractAll>); + func->bindFunc = bindFunc; + functionSet.emplace_back(std::move(func)); + func = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::STRING, LogicalTypeID::INT64}, LogicalTypeID::LIST, ScalarFunction::TernaryStringExecFunction, - nullptr, bindFunc)); + RegexpExtractAll>); + func->bindFunc = bindFunc; + functionSet.emplace_back(std::move(func)); return functionSet; } function_set RegexpSplitToArrayFunction::getFunctionSet() { function_set functionSet; - functionSet.emplace_back(make_unique(name, + auto func = std::make_unique(name, std::vector{LogicalTypeID::STRING, LogicalTypeID::STRING}, LogicalTypeID::LIST, ScalarFunction::BinaryStringExecFunction, - bindFunc)); + RegexpSplitToArray>); + func->bindFunc = bindFunc; + functionSet.emplace_back(std::move(func)); return functionSet; } diff --git a/src/include/function/comparison/vector_comparison_functions.h b/src/include/function/comparison/vector_comparison_functions.h index 84ca149ca6e..42b23ffff4a 100644 --- a/src/include/function/comparison/vector_comparison_functions.h +++ b/src/include/function/comparison/vector_comparison_functions.h @@ -66,11 +66,12 @@ struct ComparisonFunction { template static std::unique_ptr getDecimalCompare(const std::string& name) { scalar_bind_func bindFunc = bindDecimalCompare; - return std::make_unique(name, + auto func = std::make_unique(name, std::vector{common::LogicalTypeID::DECIMAL, common::LogicalTypeID::DECIMAL}, - common::LogicalTypeID::BOOL, nullptr, nullptr, - bindFunc); // necessary because decimal physical type is not known from the ID + common::LogicalTypeID::BOOL); // necessary because decimal physical type is not known from the ID + func->bindFunc = bindFunc; + return func; } // When comparing two values, we guarantee that they must have the same dataType. So we only diff --git a/src/include/function/function.h b/src/include/function/function.h index 37d0cf42c16..909e645b98b 100644 --- a/src/include/function/function.h +++ b/src/include/function/function.h @@ -86,10 +86,13 @@ struct Function { }; struct ScalarOrAggregateFunction : public Function { - common::LogicalTypeID returnTypeID; - scalar_bind_func bindFunc; + common::LogicalTypeID returnTypeID = common::LogicalTypeID::ANY; + scalar_bind_func bindFunc = nullptr; - ScalarOrAggregateFunction() : returnTypeID{common::LogicalTypeID::ANY}, bindFunc{nullptr} {} + ScalarOrAggregateFunction() : Function{} {} + ScalarOrAggregateFunction(std::string name, std::vector parameterTypeIDs, + common::LogicalTypeID returnTypeID) + : Function{std::move(name), std::move(parameterTypeIDs)}, returnTypeID{returnTypeID} {} ScalarOrAggregateFunction(std::string name, std::vector parameterTypeIDs, common::LogicalTypeID returnTypeID, scalar_bind_func bindFunc) : Function{std::move(name), std::move(parameterTypeIDs)}, returnTypeID{returnTypeID}, diff --git a/src/include/function/scalar_function.h b/src/include/function/scalar_function.h index a87afcb032c..ee9b119648e 100644 --- a/src/include/function/scalar_function.h +++ b/src/include/function/scalar_function.h @@ -27,41 +27,18 @@ struct ScalarFunction : public ScalarOrAggregateFunction { scalar_func_compile_exec_t compileFunc = nullptr; ScalarFunction() = default; + ScalarFunction(std::string name, std::vector parameterTypeIDs, + common::LogicalTypeID returnTypeID) + : ScalarOrAggregateFunction{std::move(name), std::move(parameterTypeIDs), returnTypeID} {} ScalarFunction(std::string name, std::vector parameterTypeIDs, common::LogicalTypeID returnTypeID, scalar_func_exec_t execFunc) - : ScalarFunction{std::move(name), std::move(parameterTypeIDs), returnTypeID, - std::move(execFunc), nullptr, nullptr, nullptr} {} - + : ScalarOrAggregateFunction{std::move(name), std::move(parameterTypeIDs), returnTypeID}, + execFunc{execFunc} {} ScalarFunction(std::string name, std::vector parameterTypeIDs, common::LogicalTypeID returnTypeID, scalar_func_exec_t execFunc, scalar_func_select_t selectFunc) - : ScalarFunction{std::move(name), std::move(parameterTypeIDs), returnTypeID, - std::move(execFunc), std::move(selectFunc), nullptr, nullptr} {} - - ScalarFunction(std::string name, std::vector parameterTypeIDs, - common::LogicalTypeID returnTypeID, scalar_func_exec_t execFunc, - scalar_func_select_t selectFunc, scalar_bind_func bindFunc) - : ScalarFunction{std::move(name), std::move(parameterTypeIDs), returnTypeID, - std::move(execFunc), std::move(selectFunc), nullptr, std::move(bindFunc)} {} - - ScalarFunction(std::string name, std::vector parameterTypeIDs, - common::LogicalTypeID returnTypeID, scalar_func_exec_t execFunc, - scalar_func_select_t selectFunc, scalar_func_compile_exec_t compileFunc, - scalar_bind_func bindFunc) - : ScalarOrAggregateFunction{std::move(name), std::move(parameterTypeIDs), returnTypeID, - std::move(bindFunc)}, - execFunc{std::move(execFunc)}, selectFunc(std::move(selectFunc)), - compileFunc{std::move(compileFunc)} {} - - ScalarFunction(std::string name, std::vector parameterTypeIDs, - common::LogicalTypeID returnTypeID, scalar_bind_func bindFunc) - : ScalarFunction{std::move(name), std::move(parameterTypeIDs), returnTypeID, - nullptr /* execFunc */, nullptr /* selectFunc */, bindFunc} {} - - ScalarFunction(std::string name, std::vector parameterTypeIDs, - common::LogicalTypeID returnTypeID, scalar_func_exec_t execFunc, scalar_bind_func bindFunc) - : ScalarFunction{std::move(name), std::move(parameterTypeIDs), returnTypeID, execFunc, - nullptr /* selectFunc */, bindFunc} {} + : ScalarOrAggregateFunction{std::move(name), std::move(parameterTypeIDs), returnTypeID}, + execFunc{execFunc}, selectFunc{selectFunc} {} template static void TernaryExecFunction(const std::vector>& params, From cf4b54822ac1b93bf560c20f71efba531d506525 Mon Sep 17 00:00:00 2001 From: xiyang Date: Tue, 24 Dec 2024 14:36:58 +0800 Subject: [PATCH 2/3] minor fix --- tools/python_api/src_cpp/py_udf.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/python_api/src_cpp/py_udf.cpp b/tools/python_api/src_cpp/py_udf.cpp index f25408041f7..2446f0329bf 100644 --- a/tools/python_api/src_cpp/py_udf.cpp +++ b/tools/python_api/src_cpp/py_udf.cpp @@ -18,7 +18,9 @@ struct PyUDFScalarFunction : public ScalarFunction { PyUDFScalarFunction(std::string name, std::vector parameterTypeIDs, common::LogicalTypeID returnTypeID, scalar_func_exec_t execFunc, scalar_bind_func bindFunc) : ScalarFunction{std::move(name), std::move(parameterTypeIDs), returnTypeID, - std::move(execFunc), std::move(bindFunc)} {} + std::move(execFunc)} { + this->bindFunc = bindFunc; + } DELETE_COPY_DEFAULT_MOVE(PyUDFScalarFunction); From ae06b8e669d181596c378b38789362f31cf9710e Mon Sep 17 00:00:00 2001 From: CI Bot Date: Tue, 24 Dec 2024 06:38:38 +0000 Subject: [PATCH 3/3] Run clang-format --- .../src/functions/scalar_functions/json_keys.cpp | 4 ++-- .../functions/scalar_functions/json_minify.cpp | 4 ++-- src/function/array/array_functions.cpp | 3 ++- src/function/list/list_agg_function.cpp | 8 ++++---- src/function/list/list_any_value_function.cpp | 4 ++-- src/function/list/list_creation.cpp | 5 ++--- src/function/list/list_sort_function.cpp | 10 ++++++---- src/function/map/map_keys_function.cpp | 4 ++-- src/function/map/map_values_function.cpp | 4 ++-- src/function/path/nodes_function.cpp | 4 ++-- src/function/path/rels_function.cpp | 4 ++-- src/function/path/semantic_function.cpp | 10 ++++++---- src/function/struct/struct_pack_function.cpp | 5 ++--- src/function/union/union_extract_function.cpp | 3 ++- src/function/union/union_value_function.cpp | 4 ++-- src/function/utility/coalesce.cpp | 5 ++--- src/function/utility/typeof.cpp | 4 ++-- src/function/vector_arithmetic_functions.cpp | 16 ++++++++-------- .../comparison/vector_comparison_functions.h | 3 ++- 19 files changed, 54 insertions(+), 50 deletions(-) diff --git a/extension/json/src/functions/scalar_functions/json_keys.cpp b/extension/json/src/functions/scalar_functions/json_keys.cpp index f306a628734..f61d6b47143 100644 --- a/extension/json/src/functions/scalar_functions/json_keys.cpp +++ b/extension/json/src/functions/scalar_functions/json_keys.cpp @@ -50,8 +50,8 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set JsonKeysFunction::getFunctionSet() { function_set result; - auto func = std::make_unique(name, std::vector{LogicalTypeID::STRING}, - LogicalTypeID::LIST, execFunc); + auto func = std::make_unique(name, + std::vector{LogicalTypeID::STRING}, LogicalTypeID::LIST, execFunc); func->bindFunc = bindFunc; result.push_back(std::move(func)); return result; diff --git a/extension/json/src/functions/scalar_functions/json_minify.cpp b/extension/json/src/functions/scalar_functions/json_minify.cpp index a93c2cb6990..03d7c05949a 100644 --- a/extension/json/src/functions/scalar_functions/json_minify.cpp +++ b/extension/json/src/functions/scalar_functions/json_minify.cpp @@ -38,8 +38,8 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set MinifyJsonFunction::getFunctionSet() { function_set result; - auto func = std::make_unique(name, std::vector{LogicalTypeID::STRING}, - LogicalTypeID::STRING, execFunc); + auto func = std::make_unique(name, + std::vector{LogicalTypeID::STRING}, LogicalTypeID::STRING, execFunc); func->bindFunc = bindFunc; result.push_back(std::move(func)); return result; diff --git a/src/function/array/array_functions.cpp b/src/function/array/array_functions.cpp index e175ee9eab0..b4a915e8e06 100644 --- a/src/function/array/array_functions.cpp +++ b/src/function/array/array_functions.cpp @@ -174,7 +174,8 @@ function_set templateGetFunctionSet(const std::string& functionName) { LogicalTypeID::ARRAY, }, LogicalTypeID::ANY); - function->bindFunc = std::bind(arrayTemplateBindFunc, functionName, std::placeholders::_1); + function->bindFunc = + std::bind(arrayTemplateBindFunc, functionName, std::placeholders::_1); result.push_back(std::move(function)); return result; } diff --git a/src/function/list/list_agg_function.cpp b/src/function/list/list_agg_function.cpp index cb3e265686a..96e0c128563 100644 --- a/src/function/list/list_agg_function.cpp +++ b/src/function/list/list_agg_function.cpp @@ -42,8 +42,8 @@ struct ListSum { function_set ListSumFunction::getFunctionSet() { function_set result; - auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST}, - LogicalTypeID::INT64); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::LIST}, LogicalTypeID::INT64); function->bindFunc = bindFuncListAggr; result.push_back(std::move(function)); return result; @@ -66,8 +66,8 @@ struct ListProduct { function_set ListProductFunction::getFunctionSet() { function_set result; - auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST}, - LogicalTypeID::INT64); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::LIST}, LogicalTypeID::INT64); function->bindFunc = bindFuncListAggr; result.push_back(std::move(function)); return result; diff --git a/src/function/list/list_any_value_function.cpp b/src/function/list/list_any_value_function.cpp index 15bb8486be3..912a86af610 100644 --- a/src/function/list/list_any_value_function.cpp +++ b/src/function/list/list_any_value_function.cpp @@ -38,8 +38,8 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set ListAnyValueFunction::getFunctionSet() { function_set result; - auto function = std::make_unique(name, std::vector{LogicalTypeID::LIST}, - LogicalTypeID::ANY); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::LIST}, LogicalTypeID::ANY); function->bindFunc = bindFunc; result.push_back(std::move(function)); return result; diff --git a/src/function/list/list_creation.cpp b/src/function/list/list_creation.cpp index 96a5c9dc33c..c5e664d0a4b 100644 --- a/src/function/list/list_creation.cpp +++ b/src/function/list/list_creation.cpp @@ -42,9 +42,8 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set ListCreationFunction::getFunctionSet() { function_set result; - auto function = - std::make_unique(name, std::vector{LogicalTypeID::ANY}, - LogicalTypeID::LIST, execFunc); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::ANY}, LogicalTypeID::LIST, execFunc); function->bindFunc = bindFunc; function->isVarLength = true; result.push_back(std::move(function)); diff --git a/src/function/list/list_sort_function.cpp b/src/function/list/list_sort_function.cpp index 651a47ebbd6..9b10f42c189 100644 --- a/src/function/list/list_sort_function.cpp +++ b/src/function/list/list_sort_function.cpp @@ -58,12 +58,13 @@ static std::unique_ptr ListReverseSortBindFunc(ScalarBindFuncI function_set ListSortFunction::getFunctionSet() { function_set result; std::unique_ptr func; - func = std::make_unique(name, - std::vector{LogicalTypeID::LIST}, LogicalTypeID::LIST); + func = std::make_unique(name, std::vector{LogicalTypeID::LIST}, + LogicalTypeID::LIST); func->bindFunc = ListSortBindFunc; result.push_back(std::move(func)); func = std::make_unique(name, - std::vector{LogicalTypeID::LIST, LogicalTypeID::STRING}, LogicalTypeID::LIST); + std::vector{LogicalTypeID::LIST, LogicalTypeID::STRING}, + LogicalTypeID::LIST); func->bindFunc = ListSortBindFunc; result.push_back(std::move(func)); func = std::make_unique(name, @@ -83,7 +84,8 @@ function_set ListReverseSortFunction::getFunctionSet() { func->bindFunc = ListReverseSortBindFunc; result.push_back(std::move(func)); func = std::make_unique(name, - std::vector{LogicalTypeID::LIST, LogicalTypeID::STRING}, LogicalTypeID::LIST); + std::vector{LogicalTypeID::LIST, LogicalTypeID::STRING}, + LogicalTypeID::LIST); func->bindFunc = ListReverseSortBindFunc; result.push_back(std::move(func)); return result; diff --git a/src/function/map/map_keys_function.cpp b/src/function/map/map_keys_function.cpp index e85ba99b042..a614018a49a 100644 --- a/src/function/map/map_keys_function.cpp +++ b/src/function/map/map_keys_function.cpp @@ -17,8 +17,8 @@ function_set MapKeysFunctions::getFunctionSet() { auto execFunc = ScalarFunction::UnaryExecNestedTypeFunction; function_set functionSet; - auto function = std::make_unique(name, std::vector{LogicalTypeID::MAP}, - LogicalTypeID::LIST, execFunc); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::MAP}, LogicalTypeID::LIST, execFunc); function->bindFunc = bindFunc; functionSet.push_back(std::move(function)); return functionSet; diff --git a/src/function/map/map_values_function.cpp b/src/function/map/map_values_function.cpp index b964f75a3b8..f784ff0a678 100644 --- a/src/function/map/map_values_function.cpp +++ b/src/function/map/map_values_function.cpp @@ -17,8 +17,8 @@ function_set MapValuesFunctions::getFunctionSet() { auto execFunc = ScalarFunction::UnaryExecNestedTypeFunction; function_set functionSet; - auto function = std::make_unique(name, std::vector{LogicalTypeID::MAP}, - LogicalTypeID::LIST, execFunc); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::MAP}, LogicalTypeID::LIST, execFunc); function->bindFunc = bindFunc; functionSet.push_back(std::move(function)); return functionSet; diff --git a/src/function/path/nodes_function.cpp b/src/function/path/nodes_function.cpp index 01f4826f4d4..4799460748f 100644 --- a/src/function/path/nodes_function.cpp +++ b/src/function/path/nodes_function.cpp @@ -20,8 +20,8 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set NodesFunction::getFunctionSet() { function_set functionSet; - auto function = std::make_unique(name, std::vector{LogicalTypeID::RECURSIVE_REL}, - LogicalTypeID::ANY); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::RECURSIVE_REL}, LogicalTypeID::ANY); function->bindFunc = bindFunc; function->compileFunc = StructExtractFunctions::compileFunc; functionSet.push_back(std::move(function)); diff --git a/src/function/path/rels_function.cpp b/src/function/path/rels_function.cpp index 5351ae65aa1..b2d4f3fb6ac 100644 --- a/src/function/path/rels_function.cpp +++ b/src/function/path/rels_function.cpp @@ -20,8 +20,8 @@ static std::unique_ptr bindFunc(ScalarBindFuncInput input) { function_set RelsFunction::getFunctionSet() { function_set functionSet; - auto function = std::make_unique(name, std::vector{LogicalTypeID::RECURSIVE_REL}, - LogicalTypeID::ANY); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::RECURSIVE_REL}, LogicalTypeID::ANY); function->bindFunc = bindFunc; function->compileFunc = StructExtractFunctions::compileFunc; functionSet.push_back(std::move(function)); diff --git a/src/function/path/semantic_function.cpp b/src/function/path/semantic_function.cpp index 7dff9b4e016..66a701c37bb 100644 --- a/src/function/path/semantic_function.cpp +++ b/src/function/path/semantic_function.cpp @@ -25,8 +25,9 @@ static bool IsTrailSelectFunc(const std::vector>& p function_set IsTrailFunction::getFunctionSet() { function_set functionSet; - auto function = std::make_unique(name, std::vector{LogicalTypeID::RECURSIVE_REL}, - LogicalTypeID::BOOL, IsTrailExecFunc, IsTrailSelectFunc); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::RECURSIVE_REL}, LogicalTypeID::BOOL, + IsTrailExecFunc, IsTrailSelectFunc); function->bindFunc = bindFunc; functionSet.push_back(std::move(function)); return functionSet; @@ -44,8 +45,9 @@ static bool IsACyclicSelectFunc(const std::vector>& function_set IsACyclicFunction::getFunctionSet() { function_set functionSet; - auto function = std::make_unique(name, std::vector{LogicalTypeID::RECURSIVE_REL}, - LogicalTypeID::BOOL, IsACyclicExecFunc, IsACyclicSelectFunc); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::RECURSIVE_REL}, LogicalTypeID::BOOL, + IsACyclicExecFunc, IsACyclicSelectFunc); function->bindFunc = bindFunc; functionSet.push_back(std::move(function)); return functionSet; diff --git a/src/function/struct/struct_pack_function.cpp b/src/function/struct/struct_pack_function.cpp index 73939bb1932..f24cb02f83a 100644 --- a/src/function/struct/struct_pack_function.cpp +++ b/src/function/struct/struct_pack_function.cpp @@ -107,9 +107,8 @@ void StructPackFunctions::undirectedRelPackExecFunc( function_set StructPackFunctions::getFunctionSet() { function_set functions; - auto function = - std::make_unique(name, std::vector{LogicalTypeID::ANY}, - LogicalTypeID::STRUCT, execFunc); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::ANY}, LogicalTypeID::STRUCT, execFunc); function->bindFunc = bindFunc; function->compileFunc = compileFunc; function->isVarLength = true; diff --git a/src/function/union/union_extract_function.cpp b/src/function/union/union_extract_function.cpp index 2cb2fa32045..b638930fd4d 100644 --- a/src/function/union/union_extract_function.cpp +++ b/src/function/union/union_extract_function.cpp @@ -10,7 +10,8 @@ namespace function { function_set UnionExtractFunction::getFunctionSet() { function_set functionSet; auto function = std::make_unique(name, - std::vector{LogicalTypeID::UNION, LogicalTypeID::STRING}, LogicalTypeID::ANY); + std::vector{LogicalTypeID::UNION, LogicalTypeID::STRING}, + LogicalTypeID::ANY); function->bindFunc = StructExtractFunctions::bindFunc; function->compileFunc = StructExtractFunctions::compileFunc; functionSet.push_back(std::move(function)); diff --git a/src/function/union/union_value_function.cpp b/src/function/union/union_value_function.cpp index b8cbdbfcdc1..6e011013d85 100644 --- a/src/function/union/union_value_function.cpp +++ b/src/function/union/union_value_function.cpp @@ -33,8 +33,8 @@ static void valueCompileFunc(FunctionBindData* /*bindData*/, function_set UnionValueFunction::getFunctionSet() { function_set functionSet; - auto function = std::make_unique(name, std::vector{LogicalTypeID::ANY}, - LogicalTypeID::UNION, execFunc); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::ANY}, LogicalTypeID::UNION, execFunc); function->bindFunc = bindFunc; function->compileFunc = valueCompileFunc; functionSet.push_back(std::move(function)); diff --git a/src/function/utility/coalesce.cpp b/src/function/utility/coalesce.cpp index 591b8985987..40f3c544bcf 100644 --- a/src/function/utility/coalesce.cpp +++ b/src/function/utility/coalesce.cpp @@ -74,9 +74,8 @@ static bool selectFunc(const std::vector>& params, function_set CoalesceFunction::getFunctionSet() { function_set functionSet; - auto function = - std::make_unique(name, std::vector{LogicalTypeID::ANY}, - LogicalTypeID::ANY, execFunc, selectFunc); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::ANY}, LogicalTypeID::ANY, execFunc, selectFunc); function->bindFunc = bindFunc; function->isVarLength = true; functionSet.push_back(std::move(function)); diff --git a/src/function/utility/typeof.cpp b/src/function/utility/typeof.cpp index ca63b7fd4d0..afc1162bf53 100644 --- a/src/function/utility/typeof.cpp +++ b/src/function/utility/typeof.cpp @@ -31,8 +31,8 @@ static void execFunc(const std::vector>&, ValueVect function_set TypeOfFunction::getFunctionSet() { function_set functionSet; - auto function = std::make_unique(name, std::vector{LogicalTypeID::ANY}, - LogicalTypeID::STRING, execFunc); + auto function = std::make_unique(name, + std::vector{LogicalTypeID::ANY}, LogicalTypeID::STRING, execFunc); function->bindFunc = bindFunc; functionSet.push_back(std::move(function)); return functionSet; diff --git a/src/function/vector_arithmetic_functions.cpp b/src/function/vector_arithmetic_functions.cpp index df9513c0aff..6411379b18f 100644 --- a/src/function/vector_arithmetic_functions.cpp +++ b/src/function/vector_arithmetic_functions.cpp @@ -319,8 +319,8 @@ function_set NegateFunction::getFunctionSet() { result.push_back(getUnaryFunction(name, typeID)); } // floor(decimal) -> decimal - auto func = std::make_unique(name, std::vector{LogicalTypeID::DECIMAL}, - LogicalTypeID::DECIMAL); + auto func = std::make_unique(name, + std::vector{LogicalTypeID::DECIMAL}, LogicalTypeID::DECIMAL); func->bindFunc = DecimalFunction::bindNegateFunc; result.push_back(std::move(func)); return result; @@ -331,8 +331,8 @@ function_set AbsFunction::getFunctionSet() { for (auto& typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) { result.push_back(getUnaryFunction(name, typeID)); } - auto func = std::make_unique(name, std::vector{LogicalTypeID::DECIMAL}, - LogicalTypeID::DECIMAL); + auto func = std::make_unique(name, + std::vector{LogicalTypeID::DECIMAL}, LogicalTypeID::DECIMAL); func->bindFunc = DecimalFunction::bindAbsFunc; result.push_back(std::move(func)); return result; @@ -343,8 +343,8 @@ function_set FloorFunction::getFunctionSet() { for (auto& typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) { result.push_back(getUnaryFunction(name, typeID)); } - auto func = std::make_unique(name, std::vector{LogicalTypeID::DECIMAL}, - LogicalTypeID::DECIMAL); + auto func = std::make_unique(name, + std::vector{LogicalTypeID::DECIMAL}, LogicalTypeID::DECIMAL); func->bindFunc = DecimalFunction::bindFloorFunc; result.push_back(std::move(func)); return result; @@ -355,8 +355,8 @@ function_set CeilFunction::getFunctionSet() { for (auto& typeID : LogicalTypeUtils::getNumericalLogicalTypeIDs()) { result.push_back(getUnaryFunction(name, typeID)); } - auto func = std::make_unique(name, std::vector{LogicalTypeID::DECIMAL}, - LogicalTypeID::DECIMAL); + auto func = std::make_unique(name, + std::vector{LogicalTypeID::DECIMAL}, LogicalTypeID::DECIMAL); func->bindFunc = DecimalFunction::bindCeilFunc; result.push_back(std::move(func)); return result; diff --git a/src/include/function/comparison/vector_comparison_functions.h b/src/include/function/comparison/vector_comparison_functions.h index 42b23ffff4a..d14769972db 100644 --- a/src/include/function/comparison/vector_comparison_functions.h +++ b/src/include/function/comparison/vector_comparison_functions.h @@ -69,7 +69,8 @@ struct ComparisonFunction { auto func = std::make_unique(name, std::vector{common::LogicalTypeID::DECIMAL, common::LogicalTypeID::DECIMAL}, - common::LogicalTypeID::BOOL); // necessary because decimal physical type is not known from the ID + common::LogicalTypeID::BOOL); // necessary because decimal physical type is not known + // from the ID func->bindFunc = bindFunc; return func; }