org.apache.hadoop.hive.ql.optimizer.ppr
Class PartitionPruner

java.lang.Object
  extended by org.apache.hadoop.hive.ql.optimizer.ppr.PartitionPruner
All Implemented Interfaces:
Transform

public class PartitionPruner
extends Object
implements Transform

The transformation step that does partition pruning.


Field Summary
static String CLASS_NAME
           
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
PartitionPruner()
           
 
Method Summary
static boolean hasColumnExpr(ExprNodeDesc desc)
          Whether the expression contains a column node or not.
static boolean onlyContainsPartnCols(Table tab, ExprNodeDesc expr)
          Find out whether the condition only contains partitioned columns.
static PrunedPartitionList prune(TableScanOperator ts, ParseContext parseCtx, String alias)
          Get the partition list for the TS operator that satisfies the partition pruner condition.
static boolean prunePartitionNames(List<String> columnNames, ExprNodeGenericFuncDesc prunerExpr, String defaultPartitionName, List<String> partNames)
          Prunes partition names to see if they match the prune expression.
 ParseContext transform(ParseContext pctx)
          All transformation steps implement this interface.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAME

public static final String CLASS_NAME

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

PartitionPruner

public PartitionPruner()
Method Detail

transform

public ParseContext transform(ParseContext pctx)
                       throws SemanticException
Description copied from interface: Transform
All transformation steps implement this interface.

Specified by:
transform in interface Transform
Parameters:
pctx - input parse context
Returns:
ParseContext
Throws:
SemanticException

onlyContainsPartnCols

public static boolean onlyContainsPartnCols(Table tab,
                                            ExprNodeDesc expr)
Find out whether the condition only contains partitioned columns. Note that if the table is not partitioned, the function always returns true. condition.

Parameters:
tab - the table object
expr - the pruner expression for the table

prune

public static PrunedPartitionList prune(TableScanOperator ts,
                                        ParseContext parseCtx,
                                        String alias)
                                 throws HiveException
Get the partition list for the TS operator that satisfies the partition pruner condition.

Throws:
HiveException

prunePartitionNames

public static boolean prunePartitionNames(List<String> columnNames,
                                          ExprNodeGenericFuncDesc prunerExpr,
                                          String defaultPartitionName,
                                          List<String> partNames)
                                   throws HiveException,
                                          org.apache.hadoop.hive.metastore.api.MetaException
Prunes partition names to see if they match the prune expression.

Parameters:
columnNames - name of partition columns
prunerExpr - The expression to match.
defaultPartitionName - name of default partition
partNames - Partition names to filter. The list is modified in place.
Returns:
Whether the list has any partitions for which the expression may or may not match.
Throws:
HiveException
org.apache.hadoop.hive.metastore.api.MetaException

hasColumnExpr

public static boolean hasColumnExpr(ExprNodeDesc desc)
Whether the expression contains a column node or not.



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