Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-25499

select unix_timestamp(dt) from table and select unix_timestamp(constant date) are different

Log workAgile BoardRank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.1.2
    • None
    • None
    • None

    Description

      I found select unix_timestamp(date column) from table and select unix_timestamp(constant date) are different in 3.1.2, for example:

      create table testdate(dt date);
      insert into testdate values('0001-12-30');

      select * from testdate; --> 0001-12-30

      select unix_timestamp(dt) from testdate; --> -62104233600

      select unix_timestamp('0001-12-30', 'yyyy-MM-dd'); --> -62104406400

      the -62104233600 is different with -62104406400.

       

      and convert timestap value is:

      select from_unixtime(-62104233600); --> 0002-01-01 00:00:00 , 62104233600 is  select unix_timestamp(date column) from table value which date is 0001-12-30.

      select from_unixtime(-62104406400); --> 0001-12-30 00:00:00

       

      Attachments

        1. 000000_0
          0.2 kB
          zhaolong
        2. image-2021-09-06-16-26-31-054.png
          98 kB
          zhaolong

        Issue Links

        Activity

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

          People

            ashish-kumar-sharma Ashish Sharma Assign to me
            fsilent zhaolong
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment