Ran Tao created CALCITE-5961:
--------------------------------

             Summary: Inference type of ARRAY_COMPACT is incorrect
                 Key: CALCITE-5961
                 URL: https://issues.apache.org/jira/browse/CALCITE-5961
             Project: Calcite
          Issue Type: Bug
            Reporter: Ran Tao
            Assignee: Ran Tao


The return type of
```
array_compact(array[null, 1, null, 2])
```
is INTEGER ARRAY NOT NULL, but from semantics the correct type should be
INTEGER NOT NULL ARRAY NOT NULL.

because the returned result can not has NULL value.

currently, array_compact use ARG0_NULLABLE which is not enough.

{code:java}
  public static final SqlFunction ARRAY_COMPACT =
      SqlBasicFunction.create(SqlKind.ARRAY_COMPACT,
          ReturnTypes.ARG0_NULLABLE,
          OperandTypes.ARRAY);{code}



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

Reply via email to