Exemplo n.º 1
0
  private void initializeInstance(
      String delimiter,
      String multilineTreatmentStr,
      String eolTreatmentStr,
      String headerTreatmentStr) {
    fieldDelimiter = StorageUtil.parseFieldDel(delimiter);

    multilineTreatment = canonicalizeMultilineTreatmentRequest(multilineTreatmentStr);
    eolTreatment = canonicalizeEOLTreatmentRequest(eolTreatmentStr);
    headerTreatment = canonicalizeHeaderTreatmentRequest(headerTreatmentStr);
  }
Exemplo n.º 2
0
  @Override
  public byte[] serialize(Tuple t) throws IOException {
    out.reset();
    int sz = t.size();
    for (int i = 0; i < sz; i++) {
      Object field = t.get(i);

      StorageUtil.putField(out, field);

      if (i == sz - 1) {
        // last field in tuple.
        out.write(recordDel);
      } else {
        out.write(fieldDel);
      }
    }
    return out.toByteArray();
  }
Exemplo n.º 3
0
 @Override
 public Tuple deserialize(byte[] bytes) throws IOException {
   Text val = new Text(bytes);
   return StorageUtil.textToTuple(val, fieldDel);
 }
Exemplo n.º 4
0
 /**
  * The constructor that accepts a user-specified field delimiter.
  *
  * @param delimiter a <code>String</code> specifying the field delimiter.
  */
 public PigStreaming(String delimiter) {
   this();
   fieldDel = StorageUtil.parseFieldDel(delimiter);
 }