org.apache.pig.newplan.logical.rules
Class MapKeysPruneHelper
java.lang.Object
org.apache.pig.newplan.logical.rules.MapKeysPruneHelper
public class MapKeysPruneHelper
- extends Object
This filter Marks every Load Operator which has a Map
with MAP_MARKER_ANNOTATION. The annotation value is
Map> where Integer is the column number
of the field and Set is the set of Keys in this field ( field is a map field only ).
It does this for only the top level schema in load.
Algorithm:
Traverse the Plan in ReverseDependency order ( ie. Sink to Source )
For LogicalRelationalOperators having MapLookupExpression in their
expressionPlan collect uid and keys related to it. This is
retained in the visitor
For ForEach having nested LogicalPlan use the same visitor hence
there is no distinction required
At Sources find all the uids provided by this source and annotate this
LogicalRelationalOperator ( load ) with Map>
containing only the column numbers that this LogicalRelationalOperator generates
NOTE: This is a simple Map Pruner. If a map key is mentioned in the script
then this pruner assumes you need the key. This pruner is not as optimized
as column pruner ( which removes a column if it is mentioned but never used )
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
REQUIRED_MAPKEYS
public static final String REQUIRED_MAPKEYS
- See Also:
- Constant Field Values
MapKeysPruneHelper
public MapKeysPruneHelper(OperatorPlan currentPlan)
check
public boolean check()
throws FrontendException
- Throws:
FrontendException
reportChanges
public OperatorPlan reportChanges()
Copyright © 2012 The Apache Software Foundation