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

ARRAY_TO_STRING function should return NULL if its 'nullValue' argument is NULL

    XMLWordPrintableJSON

Details

    Description

      This is the current definition of the function ARRAY_TO_STRING in SqlLibraryOperators:

        /** The "ARRAY_TO_STRING(array, delimiter [, nullText ])" function. */
        @LibraryOperator(libraries = {BIG_QUERY})
        public static final SqlFunction ARRAY_TO_STRING =
            SqlBasicFunction.create(SqlKind.ARRAY_TO_STRING,
                ReturnTypes.VARCHAR_NULLABLE,
                OperandTypes.STRING_ARRAY_CHARACTER_OPTIONAL_CHARACTER);
      

      So the result is nullable if any of the arguments is nullable. However, the nullability of the last argument does not influence the result nullabillity: a NULL value for the third optional argument will not cause a NULL value to be output.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: