Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-5597

Incorrect "bits" vector allocation in nullable vectors allocateNew()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.10.0
    • 1.12.0
    • None
    • None

    Description

      Consider the following code in a generated nullable vector, such as NullableBigIntVector:

        public void allocateNew(int valueCount) {
          try {
            values.allocateNew(valueCount);
            bits.allocateNew(valueCount+1);
      

      There are as may "bits" entries as data entries, no need to allocate an extra 1. When the valueCount is a power of two, the error will cause the allocation of twice as large a vector as necessary. (128K, say, instead of 64K, since 64K+1 power-of-two rounds to 128K.)

      By contrast the +1 correction is needed for offset vectors, but the "bits" vector is not an offset vector.

      By contrast, another variation of the same method is correct:

        public void allocateNew(int totalBytes, int valueCount) {
          try {
            values.allocateNew(totalBytes, valueCount);
            bits.allocateNew(valueCount);
      

      Attachments

        Issue Links

          Activity

            People

              paul-rogers Paul Rogers
              paul-rogers Paul Rogers
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: