Beispiel #1
0
 @Override
 public void skipRows(long numNonNullValues) throws IOException {
   long childSkip = 0;
   for (long i = 0; i < numNonNullValues; ++i) {
     childSkip += lengths.next();
   }
   keyReader.skipRowsInComplexType(childSkip);
   valueReader.skipRowsInComplexType(childSkip);
 }
Beispiel #2
0
 @Override
 public void close() throws IOException {
   super.close();
   if (keyReader != null) {
     keyReader.close();
   }
   if (valueReader != null) {
     valueReader.close();
   }
   if (lengths != null) {
     lengths.close();
   }
 }
Beispiel #3
0
  @Override
  public Object next(Object previous) throws IOException {
    Map<Object, Object> result = null;
    if (valuePresent) {
      final int length = nextLength();
      result = new HashMap<Object, Object>(length);

      // read the new elements into the array
      for (int i = 0; i < length; i++) {
        result.put(
            keyReader.getInComplexType(null, previousRow),
            valueReader.getInComplexType(null, previousRow));
      }
    }
    return result;
  }
  @Override
  public void startStripe(
      Map<StreamName, InStream> streams,
      List<OrcProto.ColumnEncoding> encodings,
      RowIndex[] indexes,
      long rowBaseInStripe)
      throws IOException {
    super.startStripe(streams, encodings, indexes, rowBaseInStripe);

    // read the dictionary blob
    dictionarySize = encodings.get(columnId).getDictionarySize();
    dictionaryValues = new long[dictionarySize];
    StreamName name = new StreamName(columnId, OrcProto.Stream.Kind.DICTIONARY_DATA);
    InStream in = streams.get(name);
    for (int i = 0; i < dictionarySize; ++i) {
      dictionaryValues[i] =
          SerializationUtils.readIntegerType(in, WriterImpl.INT_BYTE_SIZE, true, in.useVInts());
    }
    in.close();
    // set up the row reader
    name = new StreamName(columnId, OrcProto.Stream.Kind.DATA);
    reader = new RunLengthIntegerReader(streams.get(name), false, getNumBytes());
    InStream inDictionaryStream =
        streams.get(new StreamName(columnId, OrcProto.Stream.Kind.IN_DICTIONARY));
    inDictionary = inDictionaryStream == null ? null : new BitFieldReader(inDictionaryStream);
    if (indexes[columnId] != null) {
      loadIndeces(indexes[columnId].getEntryList(), 0);
    }
  }
Beispiel #5
0
 @Override
 public void startStripe(
     Map<StreamName, InStream> streams,
     List<OrcProto.ColumnEncoding> encodings,
     RowIndex[] indexes,
     long rowBaseInStripe)
     throws IOException {
   super.startStripe(streams, encodings, indexes, rowBaseInStripe);
   keyReader.startStripe(streams, encodings, indexes, rowBaseInStripe);
   valueReader.startStripe(streams, encodings, indexes, rowBaseInStripe);
   lengths =
       new RunLengthIntegerReader(
           streams.get(new StreamName(columnId, OrcProto.Stream.Kind.LENGTH)),
           false,
           WriterImpl.INT_BYTE_SIZE);
   if (indexes[columnId] != null) {
     loadIndeces(indexes[columnId].getEntryList(), 0);
   }
 }
 @Override
 public void close() throws IOException {
   super.close();
   if (reader != null) {
     reader.close();
   }
   if (inDictionary != null) {
     inDictionary.close();
   }
   dictionaryValues = null;
 }
Beispiel #7
0
 @Override
 protected void seek(int rowIndexEntry, boolean backwards) throws IOException {
   super.seek(rowIndexEntry, backwards);
   keyReader.seek(rowIndexEntry, backwards);
   valueReader.seek(rowIndexEntry, backwards);
 }