You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Alan Gates (Commented) (JIRA)" <ji...@apache.org> on 2012/01/03 23:42:40 UTC

[jira] [Commented] (PIG-2317) Ruby/Jruby UDFs

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

Alan Gates commented on PIG-2317:
---------------------------------

I've been reviewing and playing with this patch over the last week.  I have a few comments, and then questions since I can't get it to work in the e2e tests.  I'll attach my changes in a new patch.

Comments:

# In JRubyScriptEngine.registerFunctions, line 130, why is canonicalName forced to the result from LongJRubyAccumulatorEvalFunc and the following switch statement commented out?  This looks like a mistake.
# In JrubyUtils.pigToRuby, converting a databytearray to a String will mangle binary data.  I don't know if Ruby has a binary type or supports a byte type.

Issue I'm seeing:

When I try to run the new e2e tests I've added, they abort with the following error message:
{code}
Pig Stack Trace
---------------
ERROR 2999: Unexpected internal error. (NoMethodError) undefined method `outputSchemaFunction' for main:Object

org.jruby.embed.EvalFailedException: (NoMethodError) undefined method `outputSchemaFunction' for main:Object
    at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:127)
    at org.apache.pig.scripting.jruby.JrubyScriptEngine$RubyFunctions.getFromCache(JrubyScriptEngine.java:80)
    at org.apache.pig.scripting.jruby.JrubyScriptEngine$RubyFunctions.getEvalFunctions(JrubyScriptEngine.java:95)
    at org.apache.pig.scripting.jruby.JrubyScriptEngine.registerFunctions(JrubyScriptEngine.java:115)
    at org.apache.pig.PigServer.registerCode(PigServer.java:525)
    at org.apache.pig.tools.grunt.GruntParser.processRegister(GruntParser.java:421)
    at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:419)
    at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:188)
    at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:164)
    at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:84)
    at org.apache.pig.Main.run(Main.java:589)
    at org.apache.pig.Main.main(Main.java:148)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
Caused by: org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `outputSchemaFunction' for main:Object
{code}

You can run the same tests by doing:

ant -Dharness.hadoop.home=<path_to_hadoop> -Dharness.old.pig=<path_to_old_pig> test-e2e-deploy-local
ant -Dharness.hadoop.home=<path_to_hadoop> -Dharness.old.pig=<path_to_old_pig> -D-Dtests.to.run="-t RubyUDFs_1" test-e2e-local

This will run just the first RubyUDF test in local mode.

                
> Ruby/Jruby UDFs
> ---------------
>
>                 Key: PIG-2317
>                 URL: https://issues.apache.org/jira/browse/PIG-2317
>             Project: Pig
>          Issue Type: New Feature
>            Reporter: Jacob Perkins
>            Assignee: Jacob Perkins
>            Priority: Minor
>             Fix For: 0.9.2
>
>         Attachments: PigUdf.rb, PigUdf.rb, jruby_scripting.patch, jruby_scripting_2_real.patch, jruby_scripting_3.patch, jruby_scripting_4.patch, jruby_scripting_5.patch, jruby_scripting_6.patch, pigjruby.rb, pigjruby.rb, pigjruby.rb, pigudf.rb
>
>
> It should be possible to write UDFs in Ruby. These UDFs will be registered in the same way as python and javascript UDFs.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira