Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonLiTree committed Apr 19, 2024
1 parent 2dd9ad0 commit 62e5b11
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions be/src/vec/functions/function_jsonb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,14 +1158,15 @@ class FunctionJsonbContains : public IFunction {
static FunctionPtr create() { return std::make_shared<FunctionJsonbContains<Impl>>(); }

DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
return std::make_shared<DataTypeUInt8>();
return make_nullable(std::make_shared<DataTypeUInt8>());
}
DataTypes get_variadic_argument_types_impl() const override {
return Impl::get_variadic_argument_types();
}
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 {
Expand Down Expand Up @@ -1242,7 +1243,8 @@ struct JsonbContainsUtil {
res->insert_data(const_cast<const char*>((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();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(BooleanType.INSTANCE).args(JsonType.INSTANCE, JsonType.INSTANCE),
Expand Down
6 changes: 3 additions & 3 deletions gensrc/script/doris_builtins_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 62e5b11

Please sign in to comment.