Examples of LongWritable


Examples of org.apache.hadoop.io.LongWritable

    //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

Examples of org.apache.hadoop.io.LongWritable

  /** {@inheritDoc} */
  public boolean nextKeyValue() throws IOException {
    try {
      if (key == null) {
        key = new LongWritable();
      }
      if (value == null) {
        value = new GenericDBWritable();
      }
      if (null == this.results) {
View Full Code Here

Examples of org.apache.hadoop.io.LongWritable

    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

Examples of org.apache.hadoop.io.LongWritable

    values.add('a');
    values.add(new Time(new Date().getTime()));
    values.add(new Time(new Date().getTime()));

    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);

    Schema pairSchema = DBMapper.getPairSchema(val.getColumns());
    Schema keySchema = Pair.getKeySchema(pairSchema);
    Schema valueSchema = Pair.getValueSchema(pairSchema);
    Pair pair = new Pair<GenericRecord, GenericRecord>(pairSchema);

    GenericRecord keyRecord = new GenericData.Record(keySchema);
    keyRecord.put(0, key.get());
    GenericRecord valueRecord = new GenericData.Record(valueSchema);
    List<Schema.Field> fieldSchemas = valueSchema.getFields();
    for (int i = 0; i < val.getValues().size(); ++i) {
      Schema.Type type = fieldSchemas.get(i).schema().getType();
      if (type.equals(Schema.Type.STRING)) {
View Full Code Here

Examples of org.apache.hadoop.io.LongWritable

    values.add('a');
    values.add(new Time(new Date().getTime()));
    values.add(new Time(new Date().getTime()));

    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);

    Schema pairSchema = DBMapper.getPairSchema(val.getColumns());
    Schema keySchema = Pair.getKeySchema(pairSchema);

    GenericRecord keyRecord = new GenericData.Record(keySchema);
    keyRecord.put(0, key.get());
    assertEquals(keyRecord,mapper.getKeyRecord(keySchema, key));
  }
View Full Code Here

Examples of org.apache.hadoop.io.LongWritable

    values.add('a');
    values.add(new Time(new Date().getTime()));
    values.add(new Time(new Date().getTime()));

    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);

    Schema pairSchema = DBMapper.getPairSchema(val.getColumns());
    Schema keySchema = Pair.getKeySchema(pairSchema);
    Schema valueSchema = Pair.getValueSchema(pairSchema);
   
View Full Code Here

Examples of org.apache.hadoop.io.LongWritable

    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));
   
    int count = 0;
    while (reader.next(writableKey, writableValue)) {
      logger.debug("Key and value is: " + writableKey + ", " + writableValue);
      assertTrue("Matched output " + writableKey , expectedOutputForKey.contains(writableKey));
View Full Code Here

Examples of org.apache.hadoop.io.LongWritable

   
    List<ValuePair> expectedOutputForKey = new ArrayList<ValuePair>();
    expectedOutputForKey.add(valuePair);
   
    List<LongWritable> expectedOutputForValue = new ArrayList<LongWritable>();
    expectedOutputForValue.add(new LongWritable(2));
   
    int count = 0;
    while (reader.next(writableKey, writableValue)) {
      logger.debug("Key and value is: " + writableKey + ", " + writableValue);
      assertTrue("Matched output " + writableKey , expectedOutputForKey.contains(writableKey));
View Full Code Here

Examples of org.apache.hadoop.io.LongWritable

    Iterator<IntWritable> iterator = values.iterator();
    while (iterator.hasNext()) {
      logger.info("Value in ScoreReducer is: " + iterator.next());
      valInLong = valInLong + 1l;
    }
    context.write(key, new LongWritable(valInLong));

  }
View Full Code Here

Examples of org.apache.hadoop.io.LongWritable

  }
 
  @Test
  public void testMergeByCustomObjectKeyWithSequenceFileInputFormat() throws Exception {   
    Student student1 = setStudent(new Text("Sam"),new Text("US"),new IntWritable(1),
        new LongWritable(9999999998l),new DoubleWritable(99.12));       
    Student student2 = setStudent(new Text("John"),new Text("AUS"),new IntWritable(2),
        new LongWritable(9999999999l),new DoubleWritable(90.12));       
    Student student3 = setStudent(new Text("Mary"),new Text("UK"),new IntWritable(3),
        new LongWritable(9999999988l),new DoubleWritable(69.12));   
    Student student4 = setStudent(new Text("Kelvin"),new Text("UK"),new IntWritable(4),
        new LongWritable(9999998888l),new DoubleWritable(59.12));
 
    HashMap<Student, Text> inputData1 = new HashMap<Student, Text>();
    inputData1.put(student1, new Text("Macon Kent,6269 Aenean St.,1-247-399-1051,08253"));
    inputData1.put(student2, new Text("Dale Zamora,521-7792 Mauris Rd.,1-214-625-6970,90510"));
    inputData1.put(student3, new Text("Charles Wood,525-9709 In Rd.,1-370-528-4758,62714"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.