BiteTheDDDDt commented on code in PR #13418: URL: https://github.com/apache/doris/pull/13418#discussion_r997105937
########## be/src/vec/functions/function_string.h: ########## @@ -420,6 +420,43 @@ class FunctionNullOrEmpty : public IFunction { } }; +class FunctionNotNullOrEmpty : public IFunction { +public: + static constexpr auto name = "not_null_or_empty"; + static FunctionPtr create() { return std::make_shared<FunctionNotNullOrEmpty>(); } + String get_name() const override { return name; } + size_t get_number_of_arguments() const override { return 1; } + + DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { + return std::make_shared<DataTypeUInt8>(); + } + + bool use_default_implementation_for_nulls() const override { return false; } + bool use_default_implementation_for_constants() const override { return true; } + + Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, + size_t result, size_t input_rows_count) override { + auto res_map = ColumnUInt8::create(input_rows_count, 0); + + auto column = block.get_by_position(arguments[0]).column; + if (auto* nullable = check_and_get_column<const ColumnNullable>(*column)) { + column = nullable->get_nested_column_ptr(); + res_map->get_data(); Review Comment: I mean, we can't guarantee that when the xth element of a ColumnNullable is null, it must have a length of 0. -- 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