public void putNext()

in rcfile/src/main/java/com/twitter/elephantbird/pig/store/RCFilePigStorage.java [181:219]


  public void putNext(Tuple t) throws IOException {
    // convert tuple fields to set of byte arrays and write to RCFile

    if (rowWritable == null) { // initialize
      if (numColumns < 1) {
        throw new IOException("number of columns is not set");
      }

      byteStream = new ByteStream.Output();
      rowWritable = new BytesRefArrayWritable();
      colValRefs = new BytesRefWritable[numColumns];

      for (int i = 0; i < numColumns; i++) {
        colValRefs[i] = new BytesRefWritable();
        rowWritable.set(i, colValRefs[i]);
      }
    }

    byteStream.reset();

    // write each field as a text (just like PigStorage)
    int sz = t.size();
    int startPos = 0;

    for (int i = 0; i < sz && i < numColumns; i++) {

      StorageUtil.putField(byteStream, t.get(i));
      colValRefs[i].set(byteStream.getData(),
                        startPos,
                        byteStream.getCount() - startPos);
       startPos = byteStream.getCount();
    }

    try {
      writer.write(null, rowWritable);
    } catch (InterruptedException e) {
      throw new IOException(e);
    }
  }