morningman opened a new issue #2913: [UDF] UDF can handle null value
URL: https://github.com/apache/incubator-doris/issues/2913
 
 
   **Describe the bug**
   When creating a udf, which may want to handle the null value, for example:
   
   ```
   BooleanVal string_empty_or_null(const StringVal& str) {
       if (str.is_null) {
           return BooleanVal(true);
       } else {
           ....
       }
   }
   ```
   
   When executing `select string_empty_or_null(NULL)`, Doris will return 
`NULL`, but excepted is
   `1` (true);
   
   **Reason**
   
   In FE query analyze phase, Doris will directly return NullLiteral if there 
is null parameter in function.
   This is because, for most all functions, when there is null parameter, the 
function is expected to return null, except for some special functions, such as 
`if`, `hll_hash`.
   
   **How to fix**
   
   If the function is a UDF, we should not just return NullLiteral, but to let 
the UDF decide what to return.
   
   
   
   

----------------------------------------------------------------
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