xiaokang commented on code in PR #24631: URL: https://github.com/apache/doris/pull/24631#discussion_r1332616433
########## be/src/vec/functions/function_jsonb.cpp: ########## @@ -353,6 +356,14 @@ class FunctionJsonbExtract : public IFunction { return make_nullable(std::make_shared<typename Impl::ReturnType>()); } + DataTypes get_variadic_argument_types_impl() const override { + if (std::is_same_v<Impl, JsonbExtractString>) { + return {std::make_shared<DataTypeJsonb>(), std::make_shared<DataTypeString>()}; + } else { + return DataTypes(); Review Comment: return {} ########## be/src/vec/functions/function_jsonb.cpp: ########## @@ -987,6 +998,7 @@ struct JsonbExtractDouble : public JsonbExtractImpl<JsonbTypeDouble> { struct JsonbExtractString : public JsonbExtractStringImpl<JsonbTypeString> { static constexpr auto name = "json_extract_string"; static constexpr auto alias = "jsonb_extract_string"; + static constexpr auto alias2 = "get_json_string"; Review Comment: name2 ########## be/src/vec/functions/simple_function_factory.h: ########## @@ -140,6 +139,11 @@ class SimpleFunctionFactory { function_creators[name] = &createDefaultFunction<Function>; } + template <class Function> + void register_function_with_variadic(std::string name) { Review Comment: duplicate ########## be/src/vec/functions/function_totype.h: ########## @@ -372,6 +373,17 @@ class FunctionBinaryToNullType : public IFunction { } }; +template <typename FromDataType, typename ToDataType> +struct GetJsonString; + +template <typename Impl> +class FunctionBinaryStringOperateToNullType; + +using GetJsonStringImpl1 = GetJsonString<DataTypeJsonb, DataTypeString>; Review Comment: do not inject specific class to generic class ########## gensrc/script/doris_builtins_functions.py: ########## @@ -1783,6 +1783,8 @@ [['get_json_string'], 'STRING', ['STRING', 'STRING'], 'ALWAYS_NULLABLE'], [['get_json_bigint'], 'BIGINT', ['VARCHAR', 'VARCHAR'], 'ALWAYS_NULLABLE'], [['get_json_bigint'], 'BIGINT', ['STRING', 'STRING'], 'ALWAYS_NULLABLE'], + [['get_json_string'], 'STRING', ['JSONB', 'VARCHAR'], 'ALWAYS_NULLABLE'], + [['get_json_string'], 'STRING', ['JSONB', 'STRING'], 'ALWAYS_NULLABLE'], Review Comment: add testcase -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org