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

Type inference of ARRAY_COMPACT is incorrect

    XMLWordPrintableJSON

Details

    Description

      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.

        public static final SqlFunction ARRAY_COMPACT =
            SqlBasicFunction.create(SqlKind.ARRAY_COMPACT,
                ReturnTypes.ARG0_NULLABLE,
                OperandTypes.ARRAY);

      Attachments

        Issue Links

          Activity

            People

              taoran Ran Tao
              taoran Ran Tao
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: