Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-5839

nullifzero and zeroifnull documentation about return type doesn't match implementation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • Impala 3.1.0
    • Docs
    • None
    • ghx-label-3

    Description

      https://impala.incubator.apache.org/docs/build/html/topics/impala_conditional_functions.html mentions return types of nullifzero and zeroifnull:

      nullifzero(numeric_expr)
      Return type: same as the initial argument value, except that integer values are promoted to BIGINT and floating-point values are promoted to DOUBLE; use CAST() when inserting into a smaller numeric column

      zeroifnull(numeric_expr)
      Return type: same as the initial argument value, except that integer values are promoted to BIGINT and floating-point values are promoted to DOUBLE; use CAST() when inserting into a smaller numeric column

      However, I see it returning the underlying type without promotion.

      [...:21000] > select typeof(nullifzero(1)), typeof(zeroifnull(cast(1 as integer)));
      ...
      +-----------------------+------------------------------------+
      | typeof(nullifzero(1)) | typeof(zeroifnull(cast(1 as int))) |
      +-----------------------+------------------------------------+
      | TINYINT               | INT                                |
      +-----------------------+------------------------------------+
      Fetched 1 row(s) in 0.02s
      

      I suspect the docs are wrong here.

      Attachments

        Activity

          People

            arodoni Alexandra Rodoni
            philip Philip Martin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: