xiong duan created CALCITE-6711:
-----------------------------------

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