[
https://issues.apache.org/jira/browse/PIG-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13123783#comment-13123783
]
Jacob Perkins commented on PIG-2317:
------------------------------------
Here's the current way the patch works.
{code:title=myudfs.rb}
hello_world_outputschema = "str:chararray"
def hello_world
"hello world"
end
complex_outputschema = "word:chararray,num:long"
def complex(word)
[word,word.length]
end
{code}
There really aren't many nice options for attaching metadata (output schema
information) to a function in ruby so I went with the above convention.
And from Pig:
{code:title=foo.pig}
register 'myudfs.rb' using jruby as myudfs;
A = LOAD 'somedata.tsv' AS (word:chararray);
B = FOREACH A GENERATE myudfs.hello_world(), myudfs.complex(word);
{code}
> 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: jruby_scripting.patch
>
>
> 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