Java Code Examples for org.apache.orc.OrcProto#Type

The following examples show how to use org.apache.orc.OrcProto#Type . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecordReaderUtils.java    From tajo with Apache License 2.0 6 votes vote down vote up
public static void addRgFilteredStreamToRanges(OrcProto.Stream stream,
                                               boolean[] includedRowGroups, boolean isCompressed, OrcProto.RowIndex index,
                                               OrcProto.ColumnEncoding encoding, OrcProto.Type type, int compressionSize, boolean hasNull,
                                               long offset, long length, DiskRangeList.CreateHelper list, boolean doMergeBuffers) {
  for (int group = 0; group < includedRowGroups.length; ++group) {
    if (!includedRowGroups[group]) continue;
    int posn = getIndexPosition(
        encoding.getKind(), type.getKind(), stream.getKind(), isCompressed, hasNull);
    long start = index.getEntry(group).getPositions(posn);
    final long nextGroupOffset;
    boolean isLast = group == (includedRowGroups.length - 1);
    nextGroupOffset = isLast ? length : index.getEntry(group + 1).getPositions(posn);

    start += offset;
    long end = offset + estimateRgEndOffset(
        isCompressed, isLast, nextGroupOffset, length, compressionSize);
    list.addOrMerge(start, end, doMergeBuffers, true);
  }
}
 
Example 2
Source File: HiveORCVectorizedReader.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private int[] getOrdinalIdsOfSelectedColumns(List< OrcProto.Type > types, List<Integer> selectedColumns, boolean isOriginal) {
  int rootColumn = isOriginal ? 0 : TRANS_ROW_COLUMN_INDEX + 1;
  int[] ids = new int[types.size()];
  OrcProto.Type root = types.get(rootColumn);

  // iterating over only direct children
  for(int i = 0; i < root.getSubtypesCount(); ++i) {
    if (selectedColumns.contains(i)) {
      // find the position of this column in the types list
      ids[i] = root.getSubtypes(i);
    }
  }

  return ids;
}
 
Example 3
Source File: HiveORCVectorizedReader.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private int[] getOrdinalIdsOfSelectedColumns(List< OrcProto.Type > types, List<Integer> selectedColumns, boolean isOriginal) {
  int rootColumn = isOriginal ? 0 : TRANS_ROW_COLUMN_INDEX + 1;
  int[] ids = new int[types.size()];
  OrcProto.Type root = types.get(rootColumn);

  // iterating over only direct children
  for(int i = 0; i < root.getSubtypesCount(); ++i) {
    if (selectedColumns.contains(i)) {
      // find the position of this column in the types list
      ids[i] = root.getSubtypes(i);
    }
  }

  return ids;
}
 
Example 4
Source File: RecordReaderUtils.java    From tajo with Apache License 2.0 5 votes vote down vote up
public static boolean[] findPresentStreamsByColumn(
    List<OrcProto.Stream> streamList, List<OrcProto.Type> types) {
  boolean[] hasNull = new boolean[types.size()];
  for(OrcProto.Stream stream: streamList) {
    if (stream.hasKind() && (stream.getKind() == OrcProto.Stream.Kind.PRESENT)) {
      hasNull[stream.getColumn()] = true;
    }
  }
  return hasNull;
}
 
Example 5
Source File: TreeReaderFactory.java    From tajo with Apache License 2.0 4 votes vote down vote up
public List<OrcProto.Type> getFileTypes() {
  return fileTypes;
}
 
Example 6
Source File: TreeReaderFactory.java    From tajo with Apache License 2.0 4 votes vote down vote up
public List<OrcProto.Type> getSchemaTypes() {
  return schemaTypes;
}