From 722c27176197dc5de1a96ed133b888c1a52b639d Mon Sep 17 00:00:00 2001 From: LemonLiTree Date: Fri, 19 Apr 2024 14:24:46 +0800 Subject: [PATCH] fix --- be/src/vec/functions/function_jsonb.cpp | 6 ++++-- .../trees/expressions/functions/scalar/JsonContains.java | 4 ++-- gensrc/script/doris_builtins_functions.py | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/be/src/vec/functions/function_jsonb.cpp b/be/src/vec/functions/function_jsonb.cpp index 97a8db84b1fc3d0..fd6662621ccdd2d 100644 --- a/be/src/vec/functions/function_jsonb.cpp +++ b/be/src/vec/functions/function_jsonb.cpp @@ -1159,7 +1159,7 @@ class FunctionJsonbContains : public IFunction { static FunctionPtr create() { return std::make_shared>(); } DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { - return std::make_shared(); + return make_nullable(std::make_shared()); } DataTypes get_variadic_argument_types_impl() const override { return Impl::get_variadic_argument_types(); @@ -1167,6 +1167,7 @@ class FunctionJsonbContains : public IFunction { size_t get_number_of_arguments() const override { return get_variadic_argument_types_impl().size(); } + bool use_default_implementation_for_nulls() const override { return false; } Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, size_t result, size_t input_rows_count) const override { @@ -1243,7 +1244,8 @@ struct JsonbContainsUtil { res->insert_data(const_cast((char*)&contains_value), 0); } - block.replace_by_position(result, std::move(res)); + block.replace_by_position(result, + ColumnNullable::create(std::move(res), std::move(null_map))); return Status::OK(); } }; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/JsonContains.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/JsonContains.java index 59513a70efd8eab..6841de6c4db4ef6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/JsonContains.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/JsonContains.java @@ -19,8 +19,8 @@ import org.apache.doris.catalog.FunctionSignature; import org.apache.doris.nereids.trees.expressions.Expression; +import org.apache.doris.nereids.trees.expressions.functions.AlwaysNullable; import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature; -import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable; import org.apache.doris.nereids.trees.expressions.literal.Literal; import org.apache.doris.nereids.trees.expressions.shape.BinaryExpression; import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; @@ -38,7 +38,7 @@ * ScalarFunction 'json_contains'. This class is generated by GenerateFunction . */ public class JsonContains extends ScalarFunction - implements BinaryExpression, ExplicitlyCastableSignature, PropagateNullable { + implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( FunctionSignature.ret(BooleanType.INSTANCE).args(JsonType.INSTANCE, JsonType.INSTANCE), diff --git a/gensrc/script/doris_builtins_functions.py b/gensrc/script/doris_builtins_functions.py index 7f58f3fd84ac894..a7079cfe2831415 100644 --- a/gensrc/script/doris_builtins_functions.py +++ b/gensrc/script/doris_builtins_functions.py @@ -1784,9 +1784,9 @@ [['json_length'], 'INT', ['JSONB'], 'ALWAYS_NULLABLE'], [['json_length'], 'INT', ['JSONB', 'VARCHAR'], 'ALWAYS_NULLABLE'], [['json_length'], 'INT', ['JSONB', 'STRING'], 'ALWAYS_NULLABLE'], - [['json_contains'], 'BOOLEAN', ['JSONB', 'JSONB'], 'DEPEND_ON_ARGUMENT'], - [['json_contains'], 'BOOLEAN', ['JSONB', 'JSONB', 'VARCHAR'], 'DEPEND_ON_ARGUMENT'], - [['json_contains'], 'BOOLEAN', ['JSONB', 'JSONB', 'STRING'], 'DEPEND_ON_ARGUMENT'], + [['json_contains'], 'BOOLEAN', ['JSONB', 'JSONB'], 'ALWAYS_NULLABLE'], + [['json_contains'], 'BOOLEAN', ['JSONB', 'JSONB', 'VARCHAR'], 'ALWAYS_NULLABLE'], + [['json_contains'], 'BOOLEAN', ['JSONB', 'JSONB', 'STRING'], 'ALWAYS_NULLABLE'], [['json_depth'], 'INT', ['JSONB'], 'DEPEND_ON_ARGUMENT'], # Json functions