本文整理汇总了Java中org.apache.hadoop.contrib.utils.join.TaggedMapOutput类的典型用法代码示例。如果您正苦于以下问题:Java TaggedMapOutput类的具体用法?Java TaggedMapOutput怎么用?Java TaggedMapOutput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TaggedMapOutput类属于org.apache.hadoop.contrib.utils.join包,在下文中一共展示了TaggedMapOutput类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: combine
import org.apache.hadoop.contrib.utils.join.TaggedMapOutput; //导入依赖的package包/类
/**
*
* @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;
}
示例2: generateGroupKey
import org.apache.hadoop.contrib.utils.join.TaggedMapOutput; //导入依赖的package包/类
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);
}
示例3: generateTaggedMapOutput
import org.apache.hadoop.contrib.utils.join.TaggedMapOutput; //导入依赖的package包/类
protected TaggedMapOutput generateTaggedMapOutput(Object value) {
TaggedMapOutput retv = new SampleTaggedMapOutput((Text) value);
retv.setTag(new Text(this.inputTag));
return retv;
}