Ejemplo n.º 1
0
  @Override
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    try {
      // get the tableDesc from the map stored in the mapjoin operator
      HashTableSinkObjectCtx ctx = MapJoinOperator.getMetadata().get(Integer.valueOf(metadataTag));

      Writable val = ctx.getSerDe().getSerializedClass().newInstance();
      val.readFields(in);
      ArrayList<Object> list =
          (ArrayList<Object>)
              ObjectInspectorUtils.copyToStandardObject(
                  ctx.getSerDe().deserialize(val),
                  ctx.getSerDe().getObjectInspector(),
                  ObjectInspectorCopyOption.WRITABLE);
      if (list == null) {
        obj = new ArrayList(0).toArray();
      } else {
        obj = list.toArray();
      }

    } catch (Exception e) {
      throw new IOException(e);
    }
  }