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

DATE and TIMESTAMP comparisons do not work

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
    • Critical
    • Resolution: Fixed
    • None
    • 2.3.0
    • Hive
    • None

    Description

      When comparing a DATE type with a TIMESTAMP type, the planner promotes both sides to string. But since the DATE value does not include the hh:mm:ss[.nnnnnnnnn] the comparison produces wrong results.

      Thanks to Jason Dere for observing this.

      Here is a portion of an EXPLAIN output:

                            Map Join Operator
                              condition map:
                                   Inner Join 0 to 1
                              keys:
                                0 UDFToString(some_timestamp) (type: string)
                                1 UDFToString(some_date) (type: string)
      

      Workaround is to cast the DATE to a TIMESTAMP.

      Attachments

        Issue Links

        Activity

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

          People

            ashutoshc Ashutosh Chauhan Assign to me
            mmccline Matt McCline
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment