Return-Path: X-Original-To: apmail-pig-dev-archive@www.apache.org Delivered-To: apmail-pig-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C34FBDD55 for ; Tue, 19 Jun 2012 19:16:38 +0000 (UTC) Received: (qmail 89698 invoked by uid 500); 19 Jun 2012 19:11:16 -0000 Delivered-To: apmail-pig-dev-archive@pig.apache.org Received: (qmail 86642 invoked by uid 500); 19 Jun 2012 19:11:08 -0000 Mailing-List: contact dev-help@pig.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pig.apache.org Delivered-To: mailing list dev@pig.apache.org Received: (qmail 57815 invoked by uid 500); 19 Jun 2012 19:09:23 -0000 Delivered-To: apmail-hadoop-pig-dev@hadoop.apache.org Received: (qmail 79966 invoked by uid 99); 19 Jun 2012 18:23:43 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Jun 2012 18:23:43 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 7D1D31402B8 for ; Tue, 19 Jun 2012 18:23:43 +0000 (UTC) Date: Tue, 19 Jun 2012 18:23:43 +0000 (UTC) From: "Daniel Dai (JIRA)" To: pig-dev@hadoop.apache.org Message-ID: <1998347059.30779.1340130223517.JavaMail.jiratomcat@issues-vm> In-Reply-To: <2131465807.600.1339269583251.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Updated] (PIG-2745) Pig e2e test RubyUDFs fails in MR mode when running from tarball MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PIG-2745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniel Dai updated PIG-2745: ---------------------------- Attachment: enable_scripting_tests_23.patch > Pig e2e test RubyUDFs fails in MR mode when running from tarball > ---------------------------------------------------------------- > > Key: PIG-2745 > URL: https://issues.apache.org/jira/browse/PIG-2745 > Project: Pig > Issue Type: Bug > Affects Versions: 0.10.1 > Reporter: Cheolsoo Park > Assignee: Cheolsoo Park > Fix For: 0.11, 0.10.1 > > Attachments: PIG-2745-2.patch, PIG-2745.patch, Test001.java, enable_scripting_tests_23.patch > > > To reproduce the issue, please run the e2e test "RubyUDFs_1" in MR mode from the tarball (not from installed Pig - please see why below). Either pseudo-distributed-mode or full-mode Hadoop can be used. > {code} > ant -Dhadoopversion=23 -Dharness.old.pig=`pwd` -Dharness.cluster.conf=/etc/hadoop/conf/ -Dharness.cluster.bin=/usr/lib/hadoop/bin/hadoop test-e2e -Dtests.to.run="-t RubyUDFs_1" > {code} > The test fails with the following error: > {code} > java.lang.IllegalStateException: Could not initialize interpreter (from file system or classpath) with /home/cheolsoo/pig-0.10/test/e2e/pig/testdist/libexec/ruby/scriptingudfs.rb > {code} > Looking at the job jar generated by Pig, "scriptingudfs.rb" can be found as follows: > {code} > [cheolsoo@c1405 pig-cheolsoo]$ jar tvf bad.jar | grep scriptingudfs.rb > 2491 Fri Jun 08 15:52:08 PDT 2012 /home/cheolsoo/pig-0.10/test/e2e/pig/testdist/libexec/ruby/scriptingudfs.rb > {code} > Looking at getScriptAsStream() method in ScriptEngine.java, "scriptingudfs.rb" is supposed to be read from the job jar, but it is not. The reason is because getResourceAsStream("/x") looks for "x" (without the leading "/") not "/x". Since "scriptingudfs.rb" is stored with it absolute path, it ends up being not found by getResourceAsStream(scriptPath). > {code} > File file = new File(scriptPath); > if (file.exists()) { > try { > is = new FileInputStream(file); > } catch (FileNotFoundException e) { > throw new IllegalStateException("could not find existing file "+scriptPath, e); > } > } else { > if (file.isAbsolute()) { > is = ScriptEngine.class.getResourceAsStream(scriptPath); > } else { > is = ScriptEngine.class.getResourceAsStream("/" + scriptPath); > } > } > {code} > In fact, the test passes if you run in local mode or from installed Pig. The reason is because "scriptingudfs.rb" is found in local file system (e.g /usr/share/pig/test/e2e/pig/udfs/ruby/scriptingudfs.rb). > The fix seems straightforward. Attached is the patch that removes the leading "/" when registering UDF scripts so that they are stored without the leading "/" in the job jar as follows: > {code} > [cheolsoo@c1405 pig-cheolsoo]$ jar tvf good.jar | grep scriptingudfs.rb > 2491 Fri Jun 08 15:52:08 PDT 2012 home/cheolsoo/pig-0.10/test/e2e/pig/testdist/libexec/ruby/scriptingudfs.rb > {code} > Thanks! -- 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