hadoop-pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Swati Jain (JIRA)" <j...@apache.org>
Subject [jira] Commented: (PIG-1510) Add `deepCopy` for LogicalExpressions
Date Tue, 17 Aug 2010 05:34:16 GMT

    [ https://issues.apache.org/jira/browse/PIG-1510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12899282#action_12899282
] 

Swati Jain commented on PIG-1510:
---------------------------------

We make a copy of all instance variables, including fieldSchema variables in expression classes.
Exceptions are:
a) Object val in ConstantExpression. We just copy a reference to the constant object value
since the object is constant by definition.
b) `fieldSchema` and `uidOnlyFieldSchema` in LogicalExpression.java since these can be constructed
when required from the expression copy by invoking `getFieldSchema` and don't need to be copied.

> Add `deepCopy` for LogicalExpressions
> -------------------------------------
>
>                 Key: PIG-1510
>                 URL: https://issues.apache.org/jira/browse/PIG-1510
>             Project: Pig
>          Issue Type: New Feature
>          Components: data
>    Affects Versions: 0.8.0
>            Reporter: Swati Jain
>            Assignee: Swati Jain
>             Fix For: 0.8.0
>
>         Attachments: deepCopy.patch, deepCopy.patch
>
>
> It would be useful to have a way to `deepCopy` an expression. `deepCopy` will create
a new object so that changes made to one object will not reflect in the copy. There are 2
reasons why we don't override clone.
> * It may be better to use `deepCopy` since the copy semantics are explicit (since deepCopy
may be expensive).
> * A second important reason for defining `deepCopy` as a separate routine is that it
can be passed a plan as an argument which will be updated as the expression is copied (through
plan.add and plan.connect).
> The usage would look like the following:
> {noformat}
> LogicalExpressionPlan logicalPlan = new LogicalExpressionPlan();
> LogicalExpression copyExpression = origExpression.deepCopy( logicalPlan );
> {noformat}
> An immediate motivation for this would be for constructing the expressions that constitute
the CNF form of an expression.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message