It is similar to the Jython implementation and uses Rhino provided in the JDK.
- tuples are converted to objects using the input schema (the other way around using the output schema)
The attached patch is not final yet. In particular it lacks unit tests.
See test/org/apache/pig/test/data/tc.js for the "transitive closure" example