Examples of IntWritable


Examples of org.apache.hadoop.io.IntWritable

    private List<TaskCompletionEvent> allMapEvents;
    /** What jobid this fetchstatus object is for*/
    private String jobId;
    
    public FetchStatus(String jobId, int numMaps) {
      this.fromEventId = new IntWritable(0);
      this.jobId = jobId;
      this.allMapEvents = new ArrayList<TaskCompletionEvent>(numMaps);
    }
View Full Code Here

Examples of org.apache.hadoop.io.IntWritable

                return SHORT_CTOR.newInstance(value);
            } catch (Exception e) {
                throw new EsHadoopIllegalStateException(e);
            }
        }
        return new IntWritable(value);
    }
View Full Code Here

Examples of org.apache.hadoop.io.IntWritable

    private int indexToEventsCache[];
    /** What jobid this fetchstatus object is for*/
    private String jobId;
    
    public FetchStatus(String jobId, int numMaps) {
      this.fromEventId = new IntWritable(0);
      this.jobId = jobId;
      this.allMapEvents = new ArrayList<TaskCompletionEvent>(numMaps);
      this.indexToEventsCache = new int[numMaps];
    }
View Full Code Here

Examples of org.apache.hadoop.io.IntWritable

            Iterator<String> iter = mapA.keySet().iterator();
            while (iter.hasNext()) {
                String mapk = iter.next();
                result += Integer.parseInt(mapA.get(mapk)) * Integer.parseInt(mapB.get(mapk));
            }
            context.write(key, new IntWritable(result));
            System.out.println();

            // System.out.println("C:" + key.toString() + "," + result);
        }
View Full Code Here

Examples of org.apache.hadoop.io.IntWritable

            while (iter.hasNext()) {
                String mapk = iter.next();
                String bVal = mapB.containsKey(mapk) ? mapB.get(mapk) : "0";
                result += Integer.parseInt(mapA.get(mapk)) * Integer.parseInt(bVal);
            }
            context.write(key, new IntWritable(result));
            System.out.println();

            // System.out.println("C:" + key.toString() + "," + result);
        }
View Full Code Here

Examples of org.apache.hadoop.io.IntWritable

    assertEquals(md5HashKey1, md5HashKey2);
  }

  @Test
  public void testMD5HashForIntWritableKey() throws IOException {
    IntWritable key = new IntWritable(123);
    MD5Hash md5HashKey1 = HashUtility.getMD5Hash(key);
    MD5Hash md5HashKey2 = HashUtility.getMD5Hash(key);
    assertEquals(md5HashKey1, md5HashKey2);
  }
View Full Code Here

Examples of org.apache.hadoop.io.IntWritable

public class TestScoreReducer {
 
  @Test
  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();
View Full Code Here

Examples of org.apache.hadoop.io.IntWritable

  }
 
  @Test(expected = IOException.class)
  public final void testReducerForNullValues() throws IOException, InterruptedException {
    ArrayList<IntWritable> values = new ArrayList<IntWritable>();
    values.add(new IntWritable(1));
    values.add(new IntWritable(1));
    Reducer.Context context = mock(Reducer.Context.class);
    ScoreReducer scoreReducer = new ScoreReducer();
    scoreReducer.reduce(null, values, context);
  }
View Full Code Here

Examples of org.apache.hadoop.io.IntWritable

    ReflectionUtils.newInstance(reader.getKeyClass(), conf);
    Writable writableValue = (Writable)
    ReflectionUtils.newInstance(reader.getValueClass(), conf);
   
    List<IntWritable> expectedOutputForValue = new ArrayList<IntWritable>();
    expectedOutputForValue.add(new IntWritable(1));
    expectedOutputForValue.add(new IntWritable(1));
   
    int count = 0;
    while (reader.next(writableKey, writableValue)) {
      logger.debug("Key and value is: " + writableKey + ", " + writableValue);
      assertTrue("Matched output " + writableValue , expectedOutputForValue.contains(writableValue));
View Full Code Here

Examples of org.apache.hadoop.io.IntWritable

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