Example #1
0
 @Override
 public void write(DataOutput out) throws IOException {
   // write Partition class name
   out.writeUTF(partition.getClass().getName());
   // write Partition object content
   partition.write(out);
 }
Example #2
0
 @Override
 public void readFields(DataInput in) throws IOException {
   // read Partition class name
   String className = in.readUTF();
   // instantiate Partition object
   Class<?> clz = ClassUtils.loadClass(className);
   if (clz == null) {
     throw new SqoopException(MRExecutionError.MAPRED_EXEC_0009, className);
   }
   try {
     partition = (Partition) clz.newInstance();
   } catch (Exception e) {
     throw new SqoopException(MRExecutionError.MAPRED_EXEC_0010, className, e);
   }
   // read Partition object content
   partition.readFields(in);
 }