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

mod and % should be equivalent

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 2.11.0
    • Impala 3.1.0
    • None
    • None
    • ghx-label-7

    Description

      The docs say:

      "mod(numeric_type a, same_type b) Purpose: Returns the modulus of a number. Equivalent to the % arithmetic operator."

      and

      "fmod(double a, double b), fmod(float a, float b) Purpose: Returns the modulus of a floating-point number. Equivalent to the % arithmetic operator."

      But these can't both be true:

      [localhost:21000] > select typeof(9.9 % 3), typeof(mod(9.9, 3)), typeof(fmod(9.9, 3));
      +-----------------+---------------------+----------------------+
      | typeof(9.9 % 3) | typeof(mod(9.9, 3)) | typeof(fmod(9.9, 3)) |
      +-----------------+---------------------+----------------------+
      | DECIMAL(2,1)    | DECIMAL(4,1)        | FLOAT                |
      +-----------------+---------------------+----------------------+
      

      Attachments

        Issue Links

          Activity

            People

              yzhangal Yongjun Zhang
              jbapple Jim Apple
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: