本文整理汇总了Java中org.apache.tez.mapreduce.combine.MRCombiner类的典型用法代码示例。如果您正苦于以下问题:Java MRCombiner类的具体用法?Java MRCombiner怎么用?Java MRCombiner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MRCombiner类属于org.apache.tez.mapreduce.combine包,在下文中一共展示了MRCombiner类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCombiner
import org.apache.tez.mapreduce.combine.MRCombiner; //导入依赖的package包/类
private void addCombiner(PhysicalPlan combinePlan, TezOperator pkgTezOp,
Configuration conf) throws IOException {
POPackage combPack = (POPackage) combinePlan.getRoots().get(0);
POLocalRearrange combRearrange = (POLocalRearrange) combinePlan
.getLeaves().get(0);
setIntermediateOutputKeyValue(combRearrange.getKeyType(), conf, pkgTezOp);
LoRearrangeDiscoverer lrDiscoverer = new LoRearrangeDiscoverer(
combinePlan, pkgTezOp, combPack);
lrDiscoverer.visit();
combinePlan.remove(combPack);
conf.set(TezRuntimeConfiguration.TEZ_RUNTIME_COMBINER_CLASS,
MRCombiner.class.getName());
conf.set(MRJobConfig.COMBINE_CLASS_ATTR,
PigCombiner.Combine.class.getName());
conf.setBoolean(MRConfiguration.MAPPER_NEW_API, true);
conf.set("pig.pigContext", ObjectSerializer.serialize(pc));
conf.set("udf.import.list",
ObjectSerializer.serialize(PigContext.getPackageImportList()));
conf.set("pig.combinePlan", ObjectSerializer.serialize(combinePlan));
conf.set("pig.combine.package", ObjectSerializer.serialize(combPack));
conf.set("pig.map.keytype", ObjectSerializer
.serialize(new byte[] { combRearrange.getKeyType() }));
}
示例2: setupMRComponents
import org.apache.tez.mapreduce.combine.MRCombiner; //导入依赖的package包/类
private static void setupMRComponents(Configuration conf) {
if (conf.get(TezRuntimeConfiguration.TEZ_RUNTIME_PARTITIONER_CLASS) == null) {
conf.set(TezRuntimeConfiguration.TEZ_RUNTIME_PARTITIONER_CLASS,
MRPartitioner.class.getName());
}
if (conf.get(TezRuntimeConfiguration.TEZ_RUNTIME_COMBINER_CLASS) == null) {
boolean useNewApi = conf.getBoolean("mapred.mapper.new-api", false);
if (useNewApi) {
if (conf.get(MRJobConfig.COMBINE_CLASS_ATTR) != null) {
conf.set(TezRuntimeConfiguration.TEZ_RUNTIME_COMBINER_CLASS, MRCombiner.class.getName());
}
} else {
if (conf.get("mapred.combiner.class") != null) {
conf.set(TezRuntimeConfiguration.TEZ_RUNTIME_COMBINER_CLASS, MRCombiner.class.getName());
}
}
}
}
示例3: doJobClientMagic
import org.apache.tez.mapreduce.combine.MRCombiner; //导入依赖的package包/类
/**
* Sets up parameters which used to be set by the MR JobClient. Includes
* setting whether to use the new api or the old api. Note: Must be called
* before generating InputSplits
*
* @param conf
* configuration for the vertex.
*/
public static void doJobClientMagic(Configuration conf) throws IOException {
setUseNewAPI(conf);
// TODO Maybe add functionality to check output specifications - e.g. fail
// early if the output directory exists.
InetAddress ip = InetAddress.getLocalHost();
if (ip != null) {
String submitHostAddress = ip.getHostAddress();
String submitHostName = ip.getHostName();
conf.set(MRJobConfig.JOB_SUBMITHOST, submitHostName);
conf.set(MRJobConfig.JOB_SUBMITHOSTADDR, submitHostAddress);
}
// conf.set("hadoop.http.filter.initializers",
// "org.apache.hadoop.yarn.server.webproxy.amfilter.AmFilterInitializer");
// Skipping setting JOB_DIR - not used by AM.
// Maybe generate SHUFFLE secret. The AM uses the job token generated in
// the AM anyway.
// TODO eventually ACLs
conf.set(TezJobConfig.TEZ_RUNTIME_PARTITIONER_CLASS, MRPartitioner.class.getName());
boolean useNewApi = conf.getBoolean("mapred.mapper.new-api", false);
if (useNewApi) {
if (conf.get(MRJobConfig.COMBINE_CLASS_ATTR) != null) {
conf.set(TezJobConfig.TEZ_RUNTIME_COMBINER_CLASS, MRCombiner.class.getName());
}
} else {
if (conf.get("mapred.combiner.class") != null) {
conf.set(TezJobConfig.TEZ_RUNTIME_COMBINER_CLASS, MRCombiner.class.getName());
}
}
setWorkingDirectory(conf);
}
示例4: getStageConfs
import org.apache.tez.mapreduce.combine.MRCombiner; //导入依赖的package包/类
/**
* Given a single base MRR config, returns a list of complete stage
* configurations.
*
* @param conf
* @return list of complete stage configurations given Conifiguration
*/
@Private
public static Configuration[] getStageConfs(Configuration conf) {
int numIntermediateStages = MultiStageMRConfigUtil
.getNumIntermediateStages(conf);
boolean hasFinalReduceStage = (conf.getInt(MRJobConfig.NUM_REDUCES, 0) > 0);
// Assuming no 0 map jobs, and the first stage is always a map.
int numStages = numIntermediateStages + (hasFinalReduceStage ? 2 : 1);
// Read split info from HDFS
conf.setBoolean(MRJobConfig.MR_TEZ_SPLITS_VIA_EVENTS, false);
// Setup Tez partitioner class
conf.set(TezJobConfig.TEZ_RUNTIME_PARTITIONER_CLASS,
MRPartitioner.class.getName());
// Setup Tez Combiner class if required.
// This would already have been set since the call is via JobClient
boolean useNewApi = conf.getBoolean("mapred.mapper.new-api", false);
if (useNewApi) {
if (conf.get(MRJobConfig.COMBINE_CLASS_ATTR) != null) {
conf.set(TezJobConfig.TEZ_RUNTIME_COMBINER_CLASS, MRCombiner.class.getName());
}
} else {
if (conf.get("mapred.combiner.class") != null) {
conf.set(TezJobConfig.TEZ_RUNTIME_COMBINER_CLASS, MRCombiner.class.getName());
}
}
Configuration confs[] = new Configuration[numStages];
Configuration nonItermediateConf = MultiStageMRConfigUtil.extractStageConf(
conf, "");
if (numStages == 1) {
confs[0] = nonItermediateConf;
confs[0].setBoolean(MRConfig.IS_MAP_PROCESSOR, true);
} else {
confs[0] = nonItermediateConf;
confs[numStages - 1] = new Configuration(nonItermediateConf);
confs[numStages -1].setBoolean(MRConfig.IS_MAP_PROCESSOR, false);
}
if (numStages > 2) {
for (int i = 1; i < numStages - 1; i++) {
confs[i] = MultiStageMRConfigUtil.extractStageConf(conf,
MultiStageMRConfigUtil.getPropertyNameForIntermediateStage(i, ""));
confs[i].setBoolean(MRConfig.IS_MAP_PROCESSOR, false);
}
}
return confs;
}
示例5: getStageConfs
import org.apache.tez.mapreduce.combine.MRCombiner; //导入依赖的package包/类
/**
* Given a single base MRR config, returns a list of complete stage
* configurations.
*
* @param conf
* @return list of complete stage configurations given Conifiguration
*/
@Private
public static Configuration[] getStageConfs(Configuration conf) {
int numIntermediateStages = MultiStageMRConfigUtil
.getNumIntermediateStages(conf);
boolean hasFinalReduceStage = (conf.getInt(MRJobConfig.NUM_REDUCES, 0) > 0);
// Assuming no 0 map jobs, and the first stage is always a map.
int numStages = numIntermediateStages + (hasFinalReduceStage ? 2 : 1);
// Read split info from HDFS
conf.setBoolean(MRJobConfig.MR_TEZ_SPLITS_VIA_EVENTS, false);
// Setup Tez partitioner class
conf.set(TezRuntimeConfiguration.TEZ_RUNTIME_PARTITIONER_CLASS,
MRPartitioner.class.getName());
// Setup Tez Combiner class if required.
// This would already have been set since the call is via JobClient
boolean useNewApi = conf.getBoolean("mapred.mapper.new-api", false);
if (useNewApi) {
if (conf.get(MRJobConfig.COMBINE_CLASS_ATTR) != null) {
conf.set(TezRuntimeConfiguration.TEZ_RUNTIME_COMBINER_CLASS, MRCombiner.class.getName());
}
} else {
if (conf.get("mapred.combiner.class") != null) {
conf.set(TezRuntimeConfiguration.TEZ_RUNTIME_COMBINER_CLASS, MRCombiner.class.getName());
}
}
Configuration confs[] = new Configuration[numStages];
Configuration nonItermediateConf = MultiStageMRConfigUtil.extractStageConf(
conf, "");
if (numStages == 1) {
confs[0] = nonItermediateConf;
confs[0].setBoolean(MRConfig.IS_MAP_PROCESSOR, true);
} else {
confs[0] = nonItermediateConf;
confs[numStages - 1] = new Configuration(nonItermediateConf);
confs[numStages -1].setBoolean(MRConfig.IS_MAP_PROCESSOR, false);
}
if (numStages > 2) {
for (int i = 1; i < numStages - 1; i++) {
confs[i] = MultiStageMRConfigUtil.extractStageConf(conf,
MultiStageMRConfigUtil.getPropertyNameForIntermediateStage(i, ""));
confs[i].setBoolean(MRConfig.IS_MAP_PROCESSOR, false);
}
}
return confs;
}