[
https://issues.apache.org/jira/browse/PIG-4644?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rohini Palaniswamy updated PIG-4644:
------------------------------------
Attachment: PIG-4644.4.patch
+1. Committed to trunk. Thanks [~erwaman] for fixing this.
Wanted the overloaded variable to be changed to protected which did not have
any modifier. There were two others as well. Minor change. Did it before
committing. PIG-4644.4.patch is the committed one.
> PORelationToExprProject.clone() is broken
> -----------------------------------------
>
> Key: PIG-4644
> URL: https://issues.apache.org/jira/browse/PIG-4644
> Project: Pig
> Issue Type: Bug
> Reporter: Ratandeep Ratti
> Assignee: Anthony Hsu
> Attachments: PIG-4644.1.patch, PIG-4644.2.patch, PIG-4644.3.patch,
> PIG-4644.4.patch
>
>
> We are receiving the following exception when using Pig
> {noformat}
> Caused by: java.lang.ClassCastException:
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject
> cannot be cast to org.apache.pig.backend.hadoop.executionen\
> gine.physicalLayer.expressionOperators.PORelationToExprProject
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.PORelationToExprProject.clone(PORelationToExprProject.java:144)
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.PORelationToExprProject.clone(PORelationToExprProject.java:50)
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan.clone(PhysicalPlan.java:227)
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.clone(POForEach.java:639)
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.clone(POForEach.java:53)
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan.clone(PhysicalPlan.java:227)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MultiQueryOptimizer.mergeDiamondMROper(MultiQueryOptimizer.java:298)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MultiQueryOptimizer.visitMROp(MultiQueryOptimizer.java:219)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceOper.visit(MapReduceOper.java:273)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceOper.visit(MapReduceOper.java:46)
> at
> org.apache.pig.impl.plan.ReverseDependencyOrderWalker.walk(ReverseDependencyOrderWalker.java:71)
> at org.apache.pig.impl.plan.PlanVisitor.visit(PlanVisitor.java:46)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MultiQueryOptimizer.visit(MultiQueryOptimizer.java:94)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher.compile(MapReduceLauncher.java:629)
> at
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher.launchPig(MapReduceLauncher.java:148)
> at org.apache.pig.PigServer.launchPlan(PigServer.java:1264)
> {noformat}
> On further investigation it seems that POProject's clone method is
> implemented as
> {noformat}
> @Override
> public POProject clone() throws CloneNotSupportedException {
> ArrayList<Integer> cols = new ArrayList<Integer>(columns.size());
> // Can resuse the same Integer objects, as they are immutable
> for (Integer i : columns) {
> cols.add(i);
> }
> POProject clone = new POProject(new OperatorKey(mKey.scope,
> NodeIdGenerator.getGenerator().getNextNodeId(mKey.scope)),
> requestedParallelism, cols);
> clone.cloneHelper(this);
> clone.overloaded = overloaded;
> clone.startCol = startCol;
> clone.isProjectToEnd = isProjectToEnd;
> clone.resultType = resultType;
> return clone;
> }
> {noformat}
> It uses a constructor to clone POProject (which break the weak rule of object
> cloning)
> In the subclass , PORelationToExprProject implements cloneable as
> {noformat}
> @Override
> public PORelationToExprProject clone() throws CloneNotSupportedException {
> return (PORelationToExprProject) super.clone();
> }
> {noformat}
> As seen from the POProject's implementation of cloneable, super.clone will
> never be of type PORelationToExprProject,
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)