HangyuanLiu commented on a change in pull request #2911: Support not_empty 
function and empty function
URL: https://github.com/apache/incubator-doris/pull/2911#discussion_r379821657
 
 

 ##########
 File path: be/src/exprs/string_functions.cpp
 ##########
 @@ -99,6 +99,32 @@ BooleanVal StringFunctions::ends_with(
     return BooleanVal(str_sp.ends_with(suffix_sp));
 }
 
+BooleanVal StringFunctions::empty(
+        FunctionContext* context, const StringVal& str) {
+    if (str.is_null) {
+        return BooleanVal::null();
+    }
+    if (str.len == 0) {
+        return 1;
+    }
+    else {
+        return 0;
+    }
+}
+
+BooleanVal StringFunctions::not_empty(
+        FunctionContext* context, const StringVal& str) {
+    if (str.is_null) {
+        return BooleanVal::null();
+    }
+    if (str.len == 0) {
+        return 0;
+    }
 
 Review comment:
   ```suggestion
       } else {
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to