Uploaded image for project: 'Parquet'
  1. Parquet
  2. PARQUET-2357

Modest refactor of CapacityByteArrayOutputStream

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.14.0
    • parquet-mr
    • None

    Description

      Optimization for the CapacityByteArrayOutputStream class:

      1. The functionality of currentSlabIndex is the same as currentSlab.position(), so there is no need to maintain the currentSlabIndex variable.
      2. When writing an array of length equal to the remaining capacity of the buffer, there is no need to expand to a new buffer.
      3. If the addSlab operation has already implemented safeguards using Math.addExact to prevent overflow of bytesAllocated and bytesUsed, it is unnecessary to perform additional checks during the write operation.

      Attachments

        Activity

          People

            fengjiajie Feng Jiajie
            fengjiajie Feng Jiajie
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: