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

Incorrect TRUNC documentation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • Impala 2.1.1, Impala 2.2
    • Impala 2.0
    • Docs

    Description

      The current TRUNC() documentation incorrectly states that these functions round a date to the sixteenth of the month. However, these functions actually round to the first of the month (which is arguably the desired behavior). Therefore, I'd suggest the documentation be fixed to reflect the actual behavior.

      Existing Documentation
      trunc(timestamp, string unit)
      Purpose: Strips off fields and optionally rounds a TIMESTAMP value.
      Unit argument: The unit argument value is case-sensitive. This argument string can be one of:
      SYYYY, YYYY, YEAR, SYEAR, YYY, YY, Y: Year (rounds up on July 1).
      Q: Quarter (rounds up on the sixteenth day of the second month of the quarter).
      MONTH, MON, MM, RM: Month (rounds up on the sixteenth day).
      WW, W: Same day of the week as the first day of the month.
      DDD, DD, J: Day of the month.
      DAY, DY, D: Starting day of the week.
      HH, HH12, HH24: Hour. A TIMESTAMP value rounded or truncated to the hour is always represented in 24-hour notation, even for the HH12 argument string.
      MI: Minute.

      Suggested Correction
      trunc(timestamp, string unit)
      Purpose: Strips off fields and optionally rounds a TIMESTAMP value.
      Unit argument: The unit argument value is case-sensitive. This argument string can be one of:
      SYYYY, YYYY, YEAR, SYEAR, YYY, YY, Y: Year (rounds to the first day of the year).
      Q: Quarter (rounds to the first day of the first month of the quarter).
      MONTH, MON, MM, RM: Month (rounds to the first day of the month).
      WW, W: Same day of the week as the first day of the month.
      DDD, DD, J: Day of the month.
      DAY, DY, D: First day of the week. (Week defaults to a Sunday-to-Saturday definition)
      HH, HH12, HH24: Hour. A TIMESTAMP value rounded or truncated to the hour is always represented in 24-hour notation, even for the HH12 argument string.
      MI: Minute.

      Attachments

        Activity

          People

            jrussell John Russell
            mji2101_impala_8ccc Matthew Isanuk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: