Craig Macdonald a écrit :
PigContext can indeed wrap up existing Pig specific system properties, given the addition of a getProperty() method as well.

For instance, many System properties are used to control HOD connection in HExecutionEngine. These could instead be stored in PigContext, which is passed to HExecutionEngine anyway.
+1

Any thoughts about set, import, include etc?

Using pigrc as a place for set commands etc would allow users to simply call pig.pl to start their Pig session - the pigrc could do imports, set appropriate properties etc. The set command may be tricky - if properties are used to control the connection to the execution engine, then changing these properties using a set command would have no effect, as PigContext.connect() has already been called by PigServer's constructor. One option might be for PigServer to delay connection until the first query is executed.

C
Yes, there seems to be an issue with the current implementation and PigContext/PigServer life cycle (see https://issues.apache.org/jira/browse/PIG-93)

Avoiding har code configration using system properties in PigServer or PigContext would allow to set the values using different approach depending on the context.

Extracting the part (populateProps in my example bellow) from PigContext and PigServer would allow other people (like me) to populate PigContext differently. For example reading xml custom configuration file, getting properties from a spring bean or get properties from a web service.

I may be missing some "big picture" here since I don't know all pig code base but on an architecture point of view it seems a better option to me...

+------------------+    +------------------+    +------------------+
| SystemPropConf   |    |   PigContext     |    |   PigServer      |
|+----------------+|    |+----------------+|    |+----------------+|
|populateProps()   |    |setProperties()   |    |setPigContext()   |
|                  |--->|getProperties()   |--->|setPigContext()   |
|+----------------+|    |+----------------+|    |connect()         |
|                  |    |                  |    |registerQuery()   |
|                  |    |                  |    |+----------------+|
+------------------+    +------------------+    +------------------+


Code would look something like:

PigContext context = new PigContext(execType);
context.setProperties(SystemPropConf.populateProps());

PigServer server = new PigServer();
server.setPigContext(context); // (or the actual contructor)
server.registerQuery()
server.store();


ps: doing "kind of" UML /ASCII art in mail is not easy :D
--
Benjamin Francisoud

Reply via email to