Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.Text


    //tableInfo.add(columnInfo4);
    tableInfo.add(columnInfo5);
   
    mapper.setTableInfo(tableInfo);
   
    mapper.map(new LongWritable(0l), new Text("1,Sam,true,84.0"), context);
   
    ArrayList values = new ArrayList();
    values.add(1l);
    values.add("Sam");
    values.add(true);
View Full Code Here


    //tableInfo.add(columnInfo4);
    tableInfo.add(columnInfo5);
   
    mapper.setTableInfo(tableInfo);
   
    mapper.map(new LongWritable(0l), new Text("1, ,true,84.0"), context);
   
    ArrayList values = new ArrayList();
    values.add(1l);
    values.add(null);
    values.add(true);
View Full Code Here

    //tableInfo.add(columnInfo4);
    tableInfo.add(columnInfo5);
   
    mapper.setTableInfo(tableInfo);
   
    mapper.map(new LongWritable(0l), new Text("1,Sam,true,84.0,42"), context);
  }
View Full Code Here

    return isOld.get();
  }

  public void setVal(V val) {
    this.val = val;
    this.valClass = new Text(val.getClass().getName());
  }
View Full Code Here

  @Override
  public void readFields(DataInput in) throws IOException {
    isOld = new BooleanWritable();
    isOld.readFields(in);
    valClass = new Text();
    valClass.readFields(in);
    try {
      val = (V) Class.forName(valClass.toString()).newInstance();
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

  private Text outkey;
  private Text outval;

  public DBInputDelimMapper() {
    outkey = new Text();
    outval = new Text();
  }
View Full Code Here

  public void testReducerValidValues() throws IOException, InterruptedException {
    ArrayList<IntWritable> values = new ArrayList<IntWritable>();
    values.add(new IntWritable(1));
    values.add(new IntWritable(1));
    ValuePair key = new ValuePair();
    key.setValue1(new Text("This is a bookdelimiterBetweenKeyAndValuevalue1"));
    key.setValue2(new Text("This is not a bookdelimiterBetweenKeyAndValuevalue2"));
    Reducer.Context context = mock(Reducer.Context.class);
    ScoreReducer scoreReducer = new ScoreReducer();
    scoreReducer.reduce(key, values, context);
    verify(context).write(key, new LongWritable(2));   
  }
View Full Code Here

    Writable writableValue = (Writable)
    ReflectionUtils.newInstance(reader.getValueClass(), conf);
   
    List<ValuePair> expectedOutputForKey = new ArrayList<ValuePair>();
    ValuePair valuePair = new ValuePair();
    valuePair.setValue1(new Text("This is a bookdelimiterBetweenKeyAndValuevalue1"));
    valuePair.setValue2(new Text("This is not a bookdelimiterBetweenKeyAndValuevalue2"));
    expectedOutputForKey.add(valuePair);
   
    List<LongWritable> expectedOutputForValue = new ArrayList<LongWritable>();
    expectedOutputForValue.add(new LongWritable(2));
   
View Full Code Here

  @Test
  public final void testMapperValidValues() throws IOException, InterruptedException {
    Mapper.Context context = mock(Mapper.Context.class);
    ScoreMapper mapper = new ScoreMapper();
    ValuePair valuePair = new ValuePair();
    valuePair.setValue1(new Text("This is a bookdelimiterBetweenKeyAndValuevalue1"));
    valuePair.setValue2(new Text("This is not a bookdelimiterBetweenKeyAndValuevalue2"));
    mapper.map(valuePair, new IntWritable(1), context);
    verify(context).write(valuePair, new IntWritable(1));   
  }
View Full Code Here

  }
 
  @Test
  public void testScoreJobForValidValues() throws Exception{
    ValuePair valuePair = new ValuePair();
    valuePair.setValue1(new Text("This is a bookdelimiterBetweenKeyAndValuevalue1"));
    valuePair.setValue2(new Text("This is not a bookdelimiterBetweenKeyAndValuevalue2"));
    HashMap<ValuePair, IntWritable> inputData1 = new HashMap<ValuePair, IntWritable>();
    inputData1.put(valuePair, new IntWritable(1));
    createSequenceFileInHdfs(inputData1, "outputOfNGramJob", "part-r-00000");
   
    HashMap<ValuePair, IntWritable> inputData2 = new HashMap<ValuePair, IntWritable>();
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.Text

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.