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

Incompatible change in Hive bucket computation

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: Closed
    • Major
    • Resolution: Fixed
    • 3.1.0
    • 3.1.2, 3.2.0, 4.0.0-alpha-1
    • None
    • None

    Description

      HIVE-20007 seems to have inadvertently changed the bucket hash code computation via ObjectInspectorUtils.getBucketHashCodeOld() for the DATE and TIMESTAMP data type2.

      DATE was previously computed using DateWritable, which uses daysSinceEpoch as the hash code. It is now computed using DateWritableV2, which uses the hash code of java.time.LocalDate (which is not days since epoch).

      TIMESTAMP was previous computed using TimestampWritable and now uses TimestampWritableV2. They ostensibly use the same hash code computation, but there are two important differences:

      1. TimestampWritable rounds the number of milliseconds into the seconds portion of the computation, but TimestampWritableV2 does not.
      2. TimestampWritable gets the epoch time from java.sql.Timestamp, which returns it relative to the JVM time zone, not UTC. TimestampWritableV2 uses a LocalDateTime relative to UTC.

      I was unable to get Hive 3.1 running in order to verify if this actually causes data to be read or written incorrectly (there may be code above this library method which makes things work correctly). However, if my understanding is correct, this means Hive 3.1 is both forwards and backwards incompatible with bucketed tables using either of these data types. It also indicates that Hive needs tests to verify that the hash code does not change between releases.

      Attachments

        1. HIVE-21376.01.patch
          67 kB
          jcamachorodriguez
        2. HIVE-21376.patch
          5 kB
          jcamachorodriguez

        Activity

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

          People

            jcamacho Jesús Camacho Rodríguez Assign to me
            electrum David Phillips
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment