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

Clean up BucketCodec

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.0-alpha-1
    • None
    • None

    Description

      A couple of nagging things caught my eye with this class. The first thing:

      BucketCodec.java
            int statementId = options.getStatementId() >= 0 ? options.getStatementId() : 0;
      
            assert this.version >=0 && this.version <= MAX_VERSION
              : "Version out of range: " + version;
            if(!(options.getBucketId() >= 0 && options.getBucketId() <= MAX_BUCKET_ID)) {
              throw new IllegalArgumentException("bucketId out of range: " + options.getBucketId());
            }
            if(!(statementId >= 0 && statementId <= MAX_STATEMENT_ID)) {
              throw new IllegalArgumentException("statementId out of range: " + statementId);
            }
      

      statementId gets capped, if it's less than 0, then it gets rounded up to 0. However, it later checks that the statementId is greater,... which is will always be 'true' since it's getting rounded.

      1. Remove the rounding behavior.
      2. Make better error message
      3. Fail-fast in the constructor if the version is invalid

      Attachments

        1. HIVE-23051.4.patch
          8 kB
          David Mollitor
        2. HIVE-23051.4.patch
          8 kB
          David Mollitor
        3. HIVE-23051.3.patch
          8 kB
          David Mollitor
        4. HIVE-23051.2.patch
          4 kB
          David Mollitor
        5. HIVE-23051.1.patch
          3 kB
          David Mollitor

        Activity

          People

            belugabehr David Mollitor
            belugabehr David Mollitor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: