@VisibleForTesting
  static int determineQueueLimit(long maxBufferedSize,
      int queueLimitMax,
      int queueLimitMin,
      TypeInfo[] typeInfos,
      int[] projectedColumnNums,
      final boolean decimal64Support) {
    assert queueLimitMax >= queueLimitMin;
    // If the values are equal, the queue limit is fixed.
    if (queueLimitMax == queueLimitMin) return queueLimitMax;
    // If there are no columns (projection only join?) just assume no weight.
    if (projectedColumnNums == null || projectedColumnNums.length == 0) return queueLimitMax;
    // total weight as bytes
    double totalWeight = 0;
    int numberOfProjectedColumns = projectedColumnNums.length;
    double scale = Math.max(Math.log(numberOfProjectedColumns), 1);

    // Assuming that an empty Column Vector is about 96 bytes the object
    // org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector object internals:
    // OFFSET  SIZE                                                      TYPE DESCRIPTION
    // VALUE
    //      0    16                                                           (object header)
    //     16     1                                                   boolean ColumnVector.noNulls
    //     17     1                                                   boolean ColumnVector.isRepeating
    //     18     1                                                   boolean ColumnVector.preFlattenIsRepeating
    //     19     1                                                   boolean ColumnVector.preFlattenNoNulls
    //     20     4                                                           (alignment/padding gap)
    //     24     8   org.apache.hadoop.hive.ql.exec.vector.ColumnVector.Type ColumnVector.type
    //     32     8                                                 boolean[] ColumnVector.isNull
    //     40     4                                                       int BytesColumnVector.nextFree
    //     44     4                                                       int BytesColumnVector.smallBufferNextFree
    //     48     4                                                       int BytesColumnVector.bufferAllocationCount
    //     52     4                                                           (alignment/padding gap)
    //     56     8                                                  byte[][] BytesColumnVector.vector
    //     64     8                                                     int[] BytesColumnVector.start
    //     72     8                                                     int[] BytesColumnVector.length
    //     80     8                                                    byte[] BytesColumnVector.buffer
    //     88     8                                                    byte[] BytesColumnVector.smallBuffer
    long columnVectorBaseSize = (long) (96 * numberOfProjectedColumns * scale);

    for (int i = 0; i < projectedColumnNums.length; i++) {
      TypeInfo ti = typeInfos[projectedColumnNums[i]];
      int colWeight;
      if (ti.getCategory() != Category.PRIMITIVE) {
        colWeight = COL_WEIGHT_COMPLEX;
      } else {
        PrimitiveTypeInfo pti = (PrimitiveTypeInfo) ti;
        switch (pti.getPrimitiveCategory()) {
        case BINARY:
        case CHAR:
        case VARCHAR:
        case STRING:
          colWeight = COL_WEIGHT_STRING;
          break;
          //Timestamp column vector uses an int and long arrays
        case TIMESTAMP:
        case INTERVAL_DAY_TIME:
          colWeight = 2;
          break;
        case DECIMAL:
          boolean useDecimal64 = false;
          if (ti instanceof DecimalTypeInfo) {
            DecimalTypeInfo dti = (DecimalTypeInfo) ti;
            if (dti.getPrecision() <= TypeDescription.MAX_DECIMAL64_PRECISION && decimal64Support) {
              useDecimal64 = true;
            }
          }
          // decimal_64 column vectors gets the same weight as long column vectors
          if (useDecimal64) {
            colWeight = 1;
          } else {
            colWeight = COL_WEIGHT_HIVEDECIMAL;
          }
          break;
        default:
          colWeight = 1;
        }
      }
      totalWeight += colWeight * 8 * scale;
    }
    //default batch size is 1024
    totalWeight *= 1024;
    totalWeight +=  columnVectorBaseSize;
    int bestEffortSize = Math.min((int) (maxBufferedSize / totalWeight), queueLimitMax);
    return Math.max(bestEffortSize, queueLimitMin);
  }
Creates the record reader and checks the input-specific compatibility.
@return The reader if the split can be read, null otherwise.
llap-server/src/java/org/apache/hadoop/hive/llap/io/api/impl/LlapRecordReader.java