Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-6283

Function ARRAY_APPEND with a NULL array argument crashes with NullPointerException

    XMLWordPrintableJSON

Details

    Description

      The following test added to SqlOperatorTest:

      f.checkNull("array_append(null, 2)");
      

      causes Calcite to crash with the following stack trace:

      java.lang.NullPointerException: componentType is null for NULL
      
      	at java.base/java.util.Objects.requireNonNull(Objects.java:347)
      	at org.apache.calcite.sql.type.NonNullableAccessors.getComponentTypeOrThrow(NonNullableAccessors.java:52)
      	at org.apache.calcite.sql.type.ArrayElementOperandTypeChecker.checkOperandTypes(ArrayElementOperandTypeChecker.java:49)
      	at org.apache.calcite.sql.SqlOperator.checkOperandTypes(SqlOperator.java:761)
      	at org.apache.calcite.sql.SqlOperator.validateOperands(SqlOperator.java:498)
      	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:347)
      	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:231)
      

      Attachments

        Issue Links

          Activity

            People

              mbudiu Mihai Budiu
              mbudiu Mihai Budiu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: