[ 
https://issues.apache.org/jira/browse/PIG-1587?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Olga Natkovich updated PIG-1587:
--------------------------------

    Fix Version/s:     (was: 0.9.0)

I don't believe there is an urgent use case for this now. Unlinking from the 
release

> Cloning utility functions for new logical plan
> ----------------------------------------------
>
>                 Key: PIG-1587
>                 URL: https://issues.apache.org/jira/browse/PIG-1587
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.8.0
>            Reporter: Daniel Dai
>
> We sometimes need to copy a logical operator/plan when writing an 
> optimization rule. Currently copy an operator/plan is awkward. We need to 
> write some utilities to facilitate this process. Swati contribute PIG-1510 
> but we feel it still cannot address most use cases. I propose to add some 
> more utilities into new logical plan:
> all LogicalExpressions:
> {code}
> copy(LogicalExpressionPlan newPlan, boolean keepUid);
> {code}
> * Do a shallow copy of the logical expression operator (except for 
> fieldSchema, uidOnlySchema, ProjectExpression.attachedRelationalOp)
> * Set the plan to newPlan
> * If keepUid is true, further copy uidOnlyFieldSchema
> all LogicalRelationalOperators:
> {code}
> copy(LogicalPlan newPlan, boolean keepUid);
> {code}
> * Do a shallow copy of the logical relational operator (except for schema, 
> uid related fields)
> * Set the plan to newPlan;
> * If the operator have inner plan/expression plan, copy the whole inner plan 
> with the same keepUid flag (Especially, LOInnerLoad will copy its inner 
> project, with the same keepUid flag)
> * If keepUid is true, further copy uid related fields (LOUnion.uidMapping, 
> LOCogroup.groupKeyUidOnlySchema, LOCogroup.generatedInputUids)
> LogicalExpressionPlan.java
> {code}
> LogicalExpressionPlan copy(LogicalRelationalOperator attachedRelationalOp, 
> boolean keepUid);
> LogicalExpressionPlan copyAbove(LogicalExpression leave, 
> LogicalRelationalOperator attachedRelationalOp, boolean keepUid);
> LogicalExpressionPlan copyBelow(LogicalExpression root, 
> LogicalRelationalOperator attachedRelationalOp, boolean keepUid);
> {code}
> * Create a new logical expression plan and copy expression operator along 
> with connection with the same keepUid flag
> * Set all ProjectExpression.attachedRelationalOp to attachedRelationalOp 
> parameter
> {code}
> Pair<List<Operator>, List<Operator>> merge(LogicalExpressionPlan plan, 
> LogicalRelationalOperator attachedRelationalOp);
> {code}
> * Merge plan into the current logical expression plan as an independent tree
> * attachedRelationalOp is the destination operator new logical expression 
> plan attached to
> * return the sources/sinks of this independent tree
> LogicalPlan.java
> {code}
> LogicalPlan copy(LOForEach foreach, boolean keepUid);
> LogicalPlan copyAbove(LogicalRelationalOperator leave, LOForEach foreach, 
> boolean keepUid);
> LogicalPlan copyBelow(LogicalRelationalOperator root, LOForEach foreach, 
> boolean keepUid);
> {code}
> * Main use case to copy inner plan of ForEach
> * Create a new logical plan and copy relational operator along with connection
> * Copy all expression plans inside relational operator, set plan and 
> attachedRelationalOp properly
> * If the plan is ForEach inner plan, param foreach is the destination ForEach 
> operator; otherwise, pass null
> {code}
> Pair<List<Operator>, List<Operator>> merge(LogicalPlan plan, LOForEach 
> foreach);
> {code}
> * Merge plan into the current logical plan as an independent tree
> * foreach is the destination LOForEach is the destination plan is a ForEach 
> inner plan; otherwise, pass null
> * return the sources/sinks of this independent tree

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to