Java Code Examples for org.apache.hadoop.contrib.utils.join.TaggedMapOutput

The following examples show how to use org.apache.hadoop.contrib.utils.join.TaggedMapOutput. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop   Source File: SampleDataJoinReducer.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param tags
 *          a list of source tags
 * @param values
 *          a value per source
 * @return combined value derived from values of the sources
 */
protected TaggedMapOutput combine(Object[] tags, Object[] values) {
  // eliminate rows which didnot match in one of the two tables (for INNER JOIN)
  if (tags.length < 2)
     return null;  
  String joinedStr = ""; 
  for (int i=0; i<tags.length; i++) {
    if (i > 0)
       joinedStr += "\t";
    // strip first column as it is the key on which we joined
    String line = ((Text) (((TaggedMapOutput) values[i]).getData())).toString();
    String[] tokens = line.split("\\t", 2);
    joinedStr += tokens[1];
  }
  TaggedMapOutput retv = new SampleTaggedMapOutput(new Text(joinedStr));
  retv.setTag((Text) tags[0]); 
  return retv;
}
 
Example 2
Source Project: big-c   Source File: SampleDataJoinReducer.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param tags
 *          a list of source tags
 * @param values
 *          a value per source
 * @return combined value derived from values of the sources
 */
protected TaggedMapOutput combine(Object[] tags, Object[] values) {
  // eliminate rows which didnot match in one of the two tables (for INNER JOIN)
  if (tags.length < 2)
     return null;  
  String joinedStr = ""; 
  for (int i=0; i<tags.length; i++) {
    if (i > 0)
       joinedStr += "\t";
    // strip first column as it is the key on which we joined
    String line = ((Text) (((TaggedMapOutput) values[i]).getData())).toString();
    String[] tokens = line.split("\\t", 2);
    joinedStr += tokens[1];
  }
  TaggedMapOutput retv = new SampleTaggedMapOutput(new Text(joinedStr));
  retv.setTag((Text) tags[0]); 
  return retv;
}
 
Example 3
Source Project: RDFS   Source File: SampleDataJoinReducer.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param tags
 *          a list of source tags
 * @param values
 *          a value per source
 * @return combined value derived from values of the sources
 */
protected TaggedMapOutput combine(Object[] tags, Object[] values) {
  // eliminate rows which didnot match in one of the two tables (for INNER JOIN)
  if (tags.length < 2)
     return null;  
  String joinedStr = ""; 
  for (int i=0; i<tags.length; i++) {
    if (i > 0)
       joinedStr += "\t";
    // strip first column as it is the key on which we joined
    String line = ((Text) (((TaggedMapOutput) values[i]).getData())).toString();
    String[] tokens = line.split("\\t", 2);
    joinedStr += tokens[1];
  }
  TaggedMapOutput retv = new SampleTaggedMapOutput(new Text(joinedStr));
  retv.setTag((Text) tags[0]); 
  return retv;
}
 
Example 4
Source Project: hadoop-gpu   Source File: SampleDataJoinReducer.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param tags
 *          a list of source tags
 * @param values
 *          a value per source
 * @return combined value derived from values of the sources
 */
protected TaggedMapOutput combine(Object[] tags, Object[] values) {
  // eliminate rows which didnot match in one of the two tables (for INNER JOIN)
  if (tags.length < 2)
     return null;  
  String joinedStr = ""; 
  for (int i=0; i<tags.length; i++) {
    if (i > 0)
       joinedStr += "\t";
    // strip first column as it is the key on which we joined
    String line = ((Text) (((TaggedMapOutput) values[i]).getData())).toString();
    String[] tokens = line.split("\\t", 2);
    joinedStr += tokens[1];
  }
  TaggedMapOutput retv = new SampleTaggedMapOutput(new Text(joinedStr));
  retv.setTag((Text) tags[0]); 
  return retv;
}
 
Example 5
Source Project: hadoop   Source File: SampleDataJoinMapper.java    License: Apache License 2.0 5 votes vote down vote up
protected Text generateGroupKey(TaggedMapOutput aRecord) {
  // first column in the input tab separated files becomes the key (to perform the JOIN)
  String line = ((Text) aRecord.getData()).toString();
  String groupKey = "";
  String[] tokens = line.split("\\t", 2);
  groupKey = tokens[0];
  return new Text(groupKey);
}
 
Example 6
Source Project: big-c   Source File: SampleDataJoinMapper.java    License: Apache License 2.0 5 votes vote down vote up
protected Text generateGroupKey(TaggedMapOutput aRecord) {
  // first column in the input tab separated files becomes the key (to perform the JOIN)
  String line = ((Text) aRecord.getData()).toString();
  String groupKey = "";
  String[] tokens = line.split("\\t", 2);
  groupKey = tokens[0];
  return new Text(groupKey);
}
 
Example 7
Source Project: RDFS   Source File: SampleDataJoinMapper.java    License: Apache License 2.0 5 votes vote down vote up
protected Text generateGroupKey(TaggedMapOutput aRecord) {
  // first column in the input tab separated files becomes the key (to perform the JOIN)
  String line = ((Text) aRecord.getData()).toString();
  String groupKey = "";
  String[] tokens = line.split("\\t", 2);
  groupKey = tokens[0];
  return new Text(groupKey);
}
 
Example 8
Source Project: hadoop-gpu   Source File: SampleDataJoinMapper.java    License: Apache License 2.0 5 votes vote down vote up
protected Text generateGroupKey(TaggedMapOutput aRecord) {
  // first column in the input tab separated files becomes the key (to perform the JOIN)
  String line = ((Text) aRecord.getData()).toString();
  String groupKey = "";
  String[] tokens = line.split("\\t", 2);
  groupKey = tokens[0];
  return new Text(groupKey);
}
 
Example 9
Source Project: hadoop   Source File: SampleDataJoinMapper.java    License: Apache License 2.0 4 votes vote down vote up
protected TaggedMapOutput generateTaggedMapOutput(Object value) {
  TaggedMapOutput retv = new SampleTaggedMapOutput((Text) value);
  retv.setTag(new Text(this.inputTag));
  return retv;
}
 
Example 10
Source Project: big-c   Source File: SampleDataJoinMapper.java    License: Apache License 2.0 4 votes vote down vote up
protected TaggedMapOutput generateTaggedMapOutput(Object value) {
  TaggedMapOutput retv = new SampleTaggedMapOutput((Text) value);
  retv.setTag(new Text(this.inputTag));
  return retv;
}
 
Example 11
Source Project: RDFS   Source File: SampleDataJoinMapper.java    License: Apache License 2.0 4 votes vote down vote up
protected TaggedMapOutput generateTaggedMapOutput(Object value) {
  TaggedMapOutput retv = new SampleTaggedMapOutput((Text) value);
  retv.setTag(new Text(this.inputTag));
  return retv;
}
 
Example 12
Source Project: hadoop-gpu   Source File: SampleDataJoinMapper.java    License: Apache License 2.0 4 votes vote down vote up
protected TaggedMapOutput generateTaggedMapOutput(Object value) {
  TaggedMapOutput retv = new SampleTaggedMapOutput((Text) value);
  retv.setTag(new Text(this.inputTag));
  return retv;
}