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

Document incompatibility between drill's to_date and hive's unix_timestamp

    XMLWordPrintableJSON

    Details

      Description

      The below query from drill produces wrong results because unix_timestamp (function from hive) returns the value in seconds while to_date treats its input in milliseconds.

      select to_date(unix_timestamp('1998-05-06', 'yyyy-MM-dd')) from dummy limit 1;
      +-------------+
      |   EXPR$0    |
      +-------------+
      | 1970-01-11  |
      +-------------+
      

      In order to make this work we should use the below query

      select to_date(unix_timestamp('1998-05-06', 'yyyy-MM-dd')*1000) from dummy limit 1;
      +-------------+
      |   EXPR$0    |
      +-------------+
      | 1998-05-06  |
      +-------------+
      

      If this is not a bug on drill's side, we should atleast document this

        Attachments

          Activity

            People

            • Assignee:
              krishahn Kristine Hahn
              Reporter:
              rkins Rahul Challapalli
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: