コード例 #1
0
 public void reduce(Text key, Iterable<DoubleWritable> values, Context context)
     throws IOException, InterruptedException {
   if (record == null) {
     throw new IOException("No output record found");
   }
   record.set("a", 125);
   record.set("b", true);
   record.set("c", 'c');
   record.set("d", new java.sql.Date(Calendar.getInstance().getTimeInMillis()));
   record.set("f", 234.526);
   record.set("t", new java.sql.Timestamp(Calendar.getInstance().getTimeInMillis()));
   record.set("v", "foobar string");
   record.set("z", new byte[10]);
   context.write(new Text("mrtarget"), record);
 }
コード例 #2
0
 public void map(LongWritable key, VerticaRecord value, Context context)
     throws IOException, InterruptedException {
   if (value.get(4) != null && value.get(1) != null) {
     context.write(new Text((String) value.get(4)), new DoubleWritable((Long) value.get(1)));
   }
 }