diff --git a/extension/json/json_functions.cpp b/extension/json/json_functions.cpp index 6115ab0613e6..b1d309f5a7f9 100644 --- a/extension/json/json_functions.cpp +++ b/extension/json/json_functions.cpp @@ -160,6 +160,7 @@ vector JSONFunctions::GetScalarFunctions() { functions.push_back(GetSerializeSqlFunction()); functions.push_back(GetDeserializeSqlFunction()); + functions.push_back(GetArrayTailFunction()); functions.push_back(GetArrayAppendFunction()); functions.push_back(GetObjectAddFunction()); return functions; diff --git a/extension/json/json_functions/json_array_tail.cpp b/extension/json/json_functions/json_array_tail.cpp index 984f8f334f9a..a109a119cf86 100644 --- a/extension/json/json_functions/json_array_tail.cpp +++ b/extension/json/json_functions/json_array_tail.cpp @@ -2,20 +2,21 @@ namespace duckdb { +yyjson_mut_val *JSONArrayTail(yyjson_mut_val *arr, yyjson_mut_doc *doc, yyjson_alc *alc, Vector &result) { + if (!yyjson_mut_is_arr(arr)) { + throw InvalidInputException("JSON input not an JSON Array"); + } + + if (yyjson_mut_arr_size(arr) == 0) { + return yyjson_mut_arr(doc); + } + + yyjson_mut_arr_remove_first(arr); + return arr; +} + static void ArrayTailFunction(DataChunk &args, ExpressionState &state, Vector &result) { - JSONExecutors::UnaryMutExecute(args, state, result, - [](yyjson_mut_val *arr, yyjson_mut_doc *doc, yyjson_alc *alc, Vector &result) { - if (!yyjson_mut_is_arr(arr)) { - throw InvalidInputException("JSON input not an JSON Array"); - } - - if (yyjson_mut_arr_size(arr) == 0) { - return yyjson_mut_arr(doc); - } - - yyjson_mut_arr_remove_first(arr); - return arr; - }); + JSONExecutors::UnaryMutExecute(args, state, result, JSONArrayTail); } static void GetArrayTailFunctionInternal(ScalarFunctionSet &set, const LogicalType &input_type) {