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

day() function returns wrong result

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 0.7
    • Impala 1.0
    • None

    Description

      The day() and dayofmonth() function should return the same result according to
      https://cwiki.apache.org/Hive/languagemanual-udf.html

      However, day() returns "day of the year".

      hive> select d_date, day(d_date), dayofmonth(d_date) from date_dim where d_date between '1970-10-30' and '1970-11-12';
      1970-10-30	30	30
      1970-10-31	31	31
      1970-11-01	1	1
      1970-11-02	2	2
      1970-11-03	3	3
      1970-11-04	4	4
      1970-11-05	5	5
      1970-11-06	6	6
      1970-11-07	7	7
      1970-11-08	8	8
      1970-11-09	9	9
      1970-11-10	10	10
      1970-11-11	11	11
      1970-11-12	12	12
      Time taken: 16.871 seconds
      
      
      impala> select d_date, day(d_date), dayofmonth(d_date) from date_dim where d_date between '1970-10-30' and '1970-11-12';
      
      +------------+-------------+--------------------+
      | d_date     | day(d_date) | dayofmonth(d_date) |
      +------------+-------------+--------------------+
      | 1970-10-30 | 303         | 30                 |
      | 1970-10-31 | 304         | 31                 |
      | 1970-11-01 | 305         | 1                  |
      | 1970-11-02 | 306         | 2                  |
      | 1970-11-03 | 307         | 3                  |
      | 1970-11-04 | 308         | 4                  |
      | 1970-11-05 | 309         | 5                  |
      | 1970-11-06 | 310         | 6                  |
      | 1970-11-07 | 311         | 7                  |
      | 1970-11-08 | 312         | 8                  |
      | 1970-11-09 | 313         | 9                  |
      | 1970-11-10 | 314         | 10                 |
      | 1970-11-11 | 315         | 11                 |
      | 1970-11-12 | 316         | 12                 |
      +------------+-------------+--------------------+
      Returned 14 row(s) in 0.39s
      
      +------------------------------------------------------------------------------+
      | version()                                                                    |
      +------------------------------------------------------------------------------+
      | impalad version 0.7 RELEASE (build 6bd9c48dac036c0a91a83a847a71458cddc0e1ad) |
      | Built on Wed, 10 Apr 2013 10:24:25 PST                                       |
      +------------------------------------------------------------------------------+
      
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            skye Skye Wanderman-Milne
            grahn Greg Rahn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment