Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-5002

Using hive's date functions on top of date column gives wrong results for local time-zone

    XMLWordPrintableJSON

Details

    Description

      git.commit.id.abbrev=190d5d4

      Wrong Result 1 :

      select l_shipdate, `month`(l_shipdate) from cp.`tpch/lineitem.parquet` where l_shipdate = date '1994-02-01' limit 2;
      +-------------+---------+
      | l_shipdate  | EXPR$1  |
      +-------------+---------+
      | 1994-02-01  | 1       |
      | 1994-02-01  | 1       |
      +-------------+---------+
      

      Wrong Result 2 :

      select l_shipdate, `day`(l_shipdate) from cp.`tpch/lineitem.parquet` where l_shipdate = date '1998-06-02' limit 2;
      +-------------+---------+
      | l_shipdate  | EXPR$1  |
      +-------------+---------+
      | 1998-06-02  | 1       |
      | 1998-06-02  | 1       |
      +-------------+---------+
      

      Correct Result :

      select l_shipdate, `month`(l_shipdate) from cp.`tpch/lineitem.parquet` where l_shipdate = date '1998-06-02' limit 2;
      +-------------+---------+
      | l_shipdate  | EXPR$1  |
      +-------------+---------+
      | 1998-06-02  | 6       |
      | 1998-06-02  | 6       |
      +-------------+---------+
      

      It looks like we are getting wrong results when the 'day' is '01'. I only tried month and day hive functions....but wouldn't be surprised if they have similar issues too.

      Attachments

        1. 0_0_0.parquet
          2.71 MB
          Rahul Kumar Challapalli

        Issue Links

          Activity

            People

              vitalii Vitalii Diravka
              rkins Rahul Kumar Challapalli
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: