[ 
https://issues.apache.org/jira/browse/CALCITE-6711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17901906#comment-17901906
 ] 

xiong duan commented on CALCITE-6711:
-------------------------------------

The incorrect data types of functions are caused by non-NULL parameters that 
may return NULL values.
For example:
{code:java}
from_base64('-1'){code}

> Functions whose output value can be null should return a nullable type
> ----------------------------------------------------------------------
>
>                 Key: CALCITE-6711
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6711
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.38.0
>            Reporter: xiong duan
>            Priority: Major
>             Fix For: 1.39.0
>
>
> Functions whose output value can be null should return a nullable type.
> These functions can be tested by adding null type judgments:
> {code:java}
> @Override public void checkNull(String expression) {
>   tester.forEachQuery(factory, expression, sql ->
>       tester.check(factory, sql, SqlTests.ANY_TYPE_NULL_CHECKER, 
> isNullValue()));
> }
> public static final TypeChecker ANY_TYPE_NULL_CHECKER = (sql, type) -> {
>   if(!type.isNullable()) {
>     fail("Should be nullable");
>   }
> };{code}
> Some functions, such as:
>  # regexp_extract_all
>  # to_code_points
>  # code_points_to_bytes
>  # REGEXP_EXTRACT
>  # REGEXP_SUBSTR
>  # NVL2
>  # from_base64
>  # parse_url



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to