java/core/src/java/org/apache/orc/impl/writer/TreeWriterBase.java
@Override
  public void writeBatch(ColumnVector vector, int offset,
                         int length) throws IOException {
    if (vector.noNulls) {
      indexStatistics.increment(length);
      if (isPresent != null) {
        for (int i = 0; i < length; ++i) {
          isPresent.write(1);
        }
      }
    } else {
      if (vector.isRepeating) {
        boolean isNull = vector.isNull[0];
        if (isPresent != null) {
          for (int i = 0; i < length; ++i) {
            isPresent.write(isNull ? 0 : 1);
          }
        }
        if (isNull) {
          foundNulls = true;
          indexStatistics.setNull();
        } else {
          indexStatistics.increment(length);
        }
      } else {
        // count the number of non-null values
        int nonNullCount = 0;
        for(int i = 0; i < length; ++i) {
          boolean isNull = vector.isNull[i + offset];
          if (!isNull) {
            nonNullCount += 1;
          }
          if (isPresent != null) {
            isPresent.write(isNull ? 0 : 1);
          }
        }
        indexStatistics.increment(nonNullCount);
        if (nonNullCount != length) {
          foundNulls = true;
          indexStatistics.setNull();
        }
      }
    }
  }
/**
   * Write the values from the given vector from offset for length elements.
   * @param vector the vector to write from
   * @param offset the first value from the vector to write
   * @param length the number of values from the vector to write
   */
Write the values from the given vector from offset for length elements.
@param vector the vector to write from
@param offset the first value from the vector to write
@param length the number of values from the vector to write
Write the values from the given vector from offset for length elements . @param vector the vector to write from @param offset the first value from the vector to write @param length the number of values from the vector to write
@Override
  public void writeBatch(ColumnVector vector, int offset,
                         int length) throws IOException {
    if (vector.noNulls) {
      indexStatistics.increment(length);
      if (isPresent != null) {
        for (int i = 0; i < length; ++i) {
          isPresent.write(1);
        }
      }
    } else {
      if (vector.isRepeating) {
        boolean isNull = vector.isNull[0];
        if (isPresent != null) {
          for (int i = 0; i < length; ++i) {
            isPresent.write(isNull ? 0 : 1);
          }
        }
        if (isNull) {
          foundNulls = true;
          indexStatistics.setNull();
        } else {
          indexStatistics.increment(length);
        }
      } else {
        int nonNullCount = 0;
        for(int i = 0; i < length; ++i) {
          boolean isNull = vector.isNull[i + offset];
          if (!isNull) {
            nonNullCount += 1;
          }
          if (isPresent != null) {
            isPresent.write(isNull ? 0 : 1);
          }
        }
        indexStatistics.increment(nonNullCount);
        if (nonNullCount != length) {
          foundNulls = true;
          indexStatistics.setNull();
        }
      }
    }
  }
@ Override public void writeBatch ( ColumnVector vector , int offset , int length ) throws IOException { if ( vector . noNulls ) { indexStatistics . increment ( length ) ; if ( isPresent != null ) { for ( int i = 0 ; i < length ; ++ i ) { isPresent . write ( 1 ) ; } } } else { if ( vector . isRepeating ) { boolean isNull = vector . isNull [ 0 ] ; if ( isPresent != null ) { for ( int i = 0 ; i < length ; ++ i ) { isPresent . write ( isNull ? 0 : 1 ) ; } } if ( isNull ) { foundNulls = true ; indexStatistics . setNull ( ) ; } else { indexStatistics . increment ( length ) ; } } else { int nonNullCount = 0 ; for ( int i = 0 ; i < length ; ++ i ) { boolean isNull = vector . isNull [ i + offset ] ; if ( ! isNull ) { nonNullCount += 1 ; } if ( isPresent != null ) { isPresent . write ( isNull ? 0 : 1 ) ; } } indexStatistics . increment ( nonNullCount ) ; if ( nonNullCount != length ) { foundNulls = true ; indexStatistics . setNull ( ) ; } } } }
Write the values from the given vector from offset for length elements.
Write the values from the given vector from offset for length elements .
// count the number of non-null values