public int initConversion(TypeInfo[] sourceTypeInfos, TypeInfo[] targetTypeInfos,
      boolean[] columnsToIncludeTruncated) {

    final int targetColumnCount;
    if (columnsToIncludeTruncated == null) {
      targetColumnCount = targetTypeInfos.length;
    } else {
      targetColumnCount = Math.min(targetTypeInfos.length, columnsToIncludeTruncated.length);
    }

    final int sourceColumnCount = Math.min(sourceTypeInfos.length, targetColumnCount);

    allocateArrays(sourceColumnCount);
    allocateConvertArrays(sourceColumnCount);

    for (int i = 0; i < sourceColumnCount; i++) {

      if (columnsToIncludeTruncated != null && !columnsToIncludeTruncated[i]) {

        // Field not included in query.

      } else {
        final TypeInfo targetTypeInfo = targetTypeInfos[i];
        final TypeInfo sourceTypeInfo = sourceTypeInfos[i];

        if (!sourceTypeInfo.equals(targetTypeInfo)) {

          if (VectorPartitionConversion.isImplicitVectorColumnConversion(
              sourceTypeInfo, targetTypeInfo)) {

            // Do implicit conversion accepting the source type and putting it in the same
            // target type ColumnVector type.
            initTargetEntry(i, i, sourceTypeInfo);

          } else {

            // Do formal conversion...
            initTargetEntry(i, i, targetTypeInfo);
            initConvertSourceEntry(i, sourceTypeInfo);

          }
        } else {

          // No conversion.
          initTargetEntry(i, i, targetTypeInfo);

        }
      }
    }

    return sourceColumnCount;
  }
Initialize for conversion from a provided (source) data types to the target data types
desired in the VectorizedRowBatch.

No projection -- the column range 0 .. count-1

   where count is the minimum of the target data type array size, included array size,
      and source data type array size.

@param sourceTypeInfos
@param targetTypeInfos
@param columnsToIncludeTruncated
               Flag array indicating which columns are to be included.
               "Truncated" because all false entries on the end of the array have been
               eliminated.
@return the minimum count described above is returned.  That is, the number of columns
        that will be processed by assign.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorAssignRow.java