예제 #1
0
  @Override
  public void map(long recordNum, Record record, TaskContext context) throws IOException {
    key.set("user_id", record.getString(0));
    key.set("brand_id", record.getString(1));

    value.set("type", record.getString(2));
    value.set("visit_datetime", record.getString(3));

    context.write(key, value); // hashmap ?
  }
예제 #2
0
    /** Writes all keys and values directly to output. */
    @Override
    public void reduce(Record key, Iterator<Record> values, TaskContext context)
        throws IOException {
      result.set(0, key.get(0));

      while (values.hasNext()) {
        Record val = values.next();
        result.set(1, val.get(0));
        context.write(result);
      }
    }
예제 #3
0
 @Override
 public void setup(TaskContext context) throws IOException {
   result = context.createOutputRecord();
 }
예제 #4
0
 @Override
 public void map(long recordNum, Record record, TaskContext context) throws IOException {
   key.set(new Object[] {(Long) record.get(0)});
   value.set(new Object[] {(Long) record.get(1)});
   context.write(key, value);
 }
예제 #5
0
 @Override
 public void setup(TaskContext context) throws IOException {
   key = context.createMapOutputKeyRecord();
   value = context.createMapOutputValueRecord();
 }