[
https://issues.apache.org/jira/browse/PIG-1881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13013722#comment-13013722
]
Xuefu Zhang commented on PIG-1881:
----------------------------------
I had a look at the patch. It appeared to me that there can be a simpler
approach.
If the proper usage of ToolPigServer is as documented, I think we only need
provide two APIs: one takes a query and returns a LogicalPlan instance, and
another one takes a LogicalPlan instance and run it. Having said that, I don't
think we need getPlans() method in ToolPigServer. Also, we wouldn't need
cloning a logical plan in PigServer. And we need none of the methods that were
reintroduced to PigServer.
Plus, I don't understand why we need PigPlans class. It doesn't seem to do
anything or hide anything.
I think it's even better to use containment instead of inheritance. We can have
a class which contains a PigServer instance, which only exposes the two API's
mentioned above. This way, you can control what the user can perform on your
class instance. Otherwise, who knows what's going to happen if I call
ToolPigServer.registerNoRun(), and then ToolPigServer.registerQuery(), and then
ToolPigServer.getPlan().
If it turns out user needs functionality of PigServer, they don't need to get
it from ToolPigServer. He/she can just instantiate a PigServer instance. But
for ToolPigServer, the only thing allowed should be just two above mentioned
API.
With above discussion, in my opinion, there is no need for the cloning method.
BTW, the original clone method had issue with line numbers.
> Need a special interface for Penny (Inspector Gadget)
> -----------------------------------------------------
>
> Key: PIG-1881
> URL: https://issues.apache.org/jira/browse/PIG-1881
> Project: Pig
> Issue Type: New Feature
> Components: impl
> Affects Versions: 0.9.0
> Reporter: Alan Gates
> Assignee: Laukik Chitnis
> Priority: Minor
> Fix For: 0.9.0
>
> Attachments: PIG-1881-4.patch, toolsserver.patch
>
>
> The proposed Penny tool needs access to Pig's new logical plan in order to
> inject code into the the dataflow. Once it has modified the plan it needs to
> then be able to hand back that modified plan and have Pig execute it.
> As we don't want to open this functionality up to general users, the proposal
> is to do this by subclasses PigServer with a new class that is marked as
> LimitedPrivate for Penny only. This class will provide calls to parse a Pig
> Latin script and return a logical plan, and one to take a logical plan and
> execute it.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira