org.apache.hadoop.hive.ql.optimizer
Class CostBasedOptimizer

java.lang.Object
  extended by org.apache.hadoop.hive.ql.optimizer.CostBasedOptimizer
All Implemented Interfaces:
net.hydromatic.optiq.tools.Frameworks.PlannerAction<org.eigenbase.rel.RelNode>

public class CostBasedOptimizer
extends Object
implements net.hydromatic.optiq.tools.Frameworks.PlannerAction<org.eigenbase.rel.RelNode>


Constructor Summary
CostBasedOptimizer(Operator sinkOp, SemanticAnalyzer semanticAnalyzer, ParseContext pCtx)
           
 
Method Summary
 org.eigenbase.rel.RelNode apply(org.eigenbase.relopt.RelOptCluster cluster, org.eigenbase.relopt.RelOptSchema relOptSchema, net.hydromatic.optiq.SchemaPlus schema)
           
static boolean canHandleOpTree(Operator sinkOp, HiveConf conf, QueryProperties qp)
           
static boolean operatorExists(HashSet<Operator> start, boolean backward, Set<org.apache.hadoop.hive.ql.plan.api.OperatorType> targetOPTypes)
          Check if operator tree, in the direction specified forward/backward, contains any operator specified in the targetOPTypes.
static ASTNode optimize(Operator sinkOp, SemanticAnalyzer semanticAnalyzer, ParseContext pCtx, List<org.apache.hadoop.hive.metastore.api.FieldSchema> resultSchema)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CostBasedOptimizer

public CostBasedOptimizer(Operator sinkOp,
                          SemanticAnalyzer semanticAnalyzer,
                          ParseContext pCtx)
Method Detail

optimize

public static ASTNode optimize(Operator sinkOp,
                               SemanticAnalyzer semanticAnalyzer,
                               ParseContext pCtx,
                               List<org.apache.hadoop.hive.metastore.api.FieldSchema> resultSchema)

apply

public org.eigenbase.rel.RelNode apply(org.eigenbase.relopt.RelOptCluster cluster,
                                       org.eigenbase.relopt.RelOptSchema relOptSchema,
                                       net.hydromatic.optiq.SchemaPlus schema)
Specified by:
apply in interface net.hydromatic.optiq.tools.Frameworks.PlannerAction<org.eigenbase.rel.RelNode>

canHandleOpTree

public static boolean canHandleOpTree(Operator sinkOp,
                                      HiveConf conf,
                                      QueryProperties qp)

operatorExists

public static boolean operatorExists(HashSet<Operator> start,
                                     boolean backward,
                                     Set<org.apache.hadoop.hive.ql.plan.api.OperatorType> targetOPTypes)
Check if operator tree, in the direction specified forward/backward, contains any operator specified in the targetOPTypes.

Parameters:
start - list of operators to start checking from
backward - direction of DAG traversal; if true implies get parent ops for traversal otherwise children will be used
targetOPTypes - Set of operator types to look for
Returns:
true if any of the operator or its parent/children is of the name specified in the targetOPTypes NOTE: 1. This employs breadth first search 2. By using HashSet for "start" we avoid revisiting same operator twice. However it doesn't prevent revisiting the same node more than once for some complex dags.


Copyright © 2014 The Apache Software Foundation. All rights reserved.