Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
courses:mapreduce-tutorial:step-27 [2012/01/28 18:34] straka |
courses:mapreduce-tutorial:step-27 [2012/01/31 14:39] (current) straka |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== MapReduce Tutorial : Custom data types ====== | + | ====== MapReduce Tutorial : Running multiple Hadoop jobs in one source file ====== |
| - | An important feature of the Java API is that custom data and format types can be provided. In this step we implement two custom data types. | + | The Java API offers possibility to submit multiple Hadoop job in one source file. A job can be submitted either using |
| + | * [[http:// | ||
| + | * [[http:// | ||
| - | ===== BERIntWritable | + | ===== Exercise 1 ===== |
| + | Improve the [[.: | ||
| - | We want to implement BERIntWritable, | + | ===== Exercise 2 ===== |
| - | The new class must implement | + | Implement |
| - | <code java> | ||
| - | public class BERIntWritable implements Writable { | ||
| - | private int value; | ||
| - | public void readFields(DataInput in) throws IOException { | + | ---- |
| - | value = 0; | + | |
| - | byte next; | + | < |
| - | while (((next | + | <table style=" |
| - | value = (value | + | <tr> |
| - | } | + | <td style=" |
| - | value = (value | + | <td style="text-align: |
| - | } | + | <td style=" |
| - | + | </tr> | |
| - | public void write(DataOutput out) throws IOException { | + | </table> |
| - | int highest_pos | + | </html> |
| - | while (highest_pos | + | |
| - | while (highest_pos | + | |
| - | out.writeByte(0x80 | + | |
| - | | + | |
| - | } | + | |
| - | out.writeByte(value & 0x7F); | + | |
| - | } | + | |
| - | </code> | + | |
| - | Some accessory methods are also needed in order to work with the value: | + | |
| - | <code java> | + | |
| - | | + | |
| - | public void set(int value) { this.value = value; } | + | |
| - | </code> | + | |
| - | + | ||
| - | ===== PairWritable<A, B> ===== | + | |
