Search in sources :

Example 1 with SetSparkReducerParallelism

use of org.apache.hadoop.hive.ql.optimizer.spark.SetSparkReducerParallelism in project hive by apache.

the class SparkCompiler method runSetReducerParallelism.

private void runSetReducerParallelism(OptimizeSparkProcContext procCtx) throws SemanticException {
    ParseContext pCtx = procCtx.getParseContext();
    Map<SemanticRule, SemanticNodeProcessor> opRules = new LinkedHashMap<SemanticRule, SemanticNodeProcessor>();
    opRules.put(new RuleRegExp("Set parallelism - ReduceSink", ReduceSinkOperator.getOperatorName() + "%"), new SetSparkReducerParallelism(pCtx.getConf()));
    // The dispatcher fires the processor corresponding to the closest matching
    // rule and passes the context along
    SemanticDispatcher disp = new DefaultRuleDispatcher(null, opRules, procCtx);
    SemanticGraphWalker ogw = new PreOrderWalker(disp);
    // Create a list of topop nodes
    ArrayList<Node> topNodes = new ArrayList<Node>();
    topNodes.addAll(pCtx.getTopOps().values());
    ogw.startWalking(topNodes, null);
}
Also used : SemanticRule(org.apache.hadoop.hive.ql.lib.SemanticRule) DefaultRuleDispatcher(org.apache.hadoop.hive.ql.lib.DefaultRuleDispatcher) Node(org.apache.hadoop.hive.ql.lib.Node) RuleRegExp(org.apache.hadoop.hive.ql.lib.RuleRegExp) ArrayList(java.util.ArrayList) SemanticGraphWalker(org.apache.hadoop.hive.ql.lib.SemanticGraphWalker) SetSparkReducerParallelism(org.apache.hadoop.hive.ql.optimizer.spark.SetSparkReducerParallelism) LinkedHashMap(java.util.LinkedHashMap) ParseContext(org.apache.hadoop.hive.ql.parse.ParseContext) SemanticDispatcher(org.apache.hadoop.hive.ql.lib.SemanticDispatcher) SemanticNodeProcessor(org.apache.hadoop.hive.ql.lib.SemanticNodeProcessor) PreOrderWalker(org.apache.hadoop.hive.ql.lib.PreOrderWalker)

Aggregations

ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 DefaultRuleDispatcher (org.apache.hadoop.hive.ql.lib.DefaultRuleDispatcher)1 Node (org.apache.hadoop.hive.ql.lib.Node)1 PreOrderWalker (org.apache.hadoop.hive.ql.lib.PreOrderWalker)1 RuleRegExp (org.apache.hadoop.hive.ql.lib.RuleRegExp)1 SemanticDispatcher (org.apache.hadoop.hive.ql.lib.SemanticDispatcher)1 SemanticGraphWalker (org.apache.hadoop.hive.ql.lib.SemanticGraphWalker)1 SemanticNodeProcessor (org.apache.hadoop.hive.ql.lib.SemanticNodeProcessor)1 SemanticRule (org.apache.hadoop.hive.ql.lib.SemanticRule)1 SetSparkReducerParallelism (org.apache.hadoop.hive.ql.optimizer.spark.SetSparkReducerParallelism)1 ParseContext (org.apache.hadoop.hive.ql.parse.ParseContext)1