Java Code Examples for org.apache.hadoop.contrib.utils.join.TaggedMapOutput#setTag()

The following examples show how to use org.apache.hadoop.contrib.utils.join.TaggedMapOutput#setTag() . 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 File: SampleDataJoinReducer.java    From hadoop with 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 File: SampleDataJoinReducer.java    From big-c with 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 File: SampleDataJoinReducer.java    From RDFS with 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 File: SampleDataJoinReducer.java    From hadoop-gpu with 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 File: SampleDataJoinMapper.java    From hadoop with 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 6
Source File: SampleDataJoinMapper.java    From big-c with 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 7
Source File: SampleDataJoinMapper.java    From RDFS with 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 8
Source File: SampleDataJoinMapper.java    From hadoop-gpu with 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;
}