You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/10/17 10:46:16 UTC
[GitHub] [doris] BiteTheDDDDt commented on a diff in pull request #13418: [function](string_function) add new string function 'not_null_or_empty'
BiteTheDDDDt commented on code in PR #13418:
URL: https://github.com/apache/doris/pull/13418#discussion_r996905606
##########
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:
We better check nullmap when input column is nullable.
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org