Return-Path: X-Original-To: apmail-pig-commits-archive@www.apache.org Delivered-To: apmail-pig-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4384018A62 for ; Wed, 10 Feb 2016 21:37:09 +0000 (UTC) Received: (qmail 9834 invoked by uid 500); 10 Feb 2016 21:37:09 -0000 Delivered-To: apmail-pig-commits-archive@pig.apache.org Received: (qmail 9802 invoked by uid 500); 10 Feb 2016 21:37:09 -0000 Mailing-List: contact commits-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 commits@pig.apache.org Received: (qmail 9793 invoked by uid 99); 10 Feb 2016 21:37:09 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Feb 2016 21:37:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id A118AC11B1 for ; Wed, 10 Feb 2016 21:37:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.558 X-Spam-Level: * X-Spam-Status: No, score=1.558 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.242] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 0GAjuF2070qD for ; Wed, 10 Feb 2016 21:37:07 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id 9FB2125E93 for ; Wed, 10 Feb 2016 21:37:06 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B3EEBE0709 for ; Wed, 10 Feb 2016 21:37:05 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 947E13A023C for ; Wed, 10 Feb 2016 21:37:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1729745 - in /pig/trunk: CHANGES.txt src/org/apache/pig/backend/hadoop/executionengine/tez/TezDagBuilder.java src/org/apache/pig/backend/hadoop/executionengine/tez/runtime/PigProcessor.java Date: Wed, 10 Feb 2016 21:37:05 -0000 To: commits@pig.apache.org From: rohini@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160210213705.947E13A023C@svn01-us-west.apache.org> Author: rohini Date: Wed Feb 10 21:37:05 2016 New Revision: 1729745 URL: http://svn.apache.org/viewvc?rev=1729745&view=rev Log: PIG-4801: Provide backward compatibility with mapreduce mapred.task settings (rohini) Modified: pig/trunk/CHANGES.txt pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/tez/TezDagBuilder.java pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/tez/runtime/PigProcessor.java Modified: pig/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1729745&r1=1729744&r2=1729745&view=diff ============================================================================== --- pig/trunk/CHANGES.txt (original) +++ pig/trunk/CHANGES.txt Wed Feb 10 21:37:05 2016 @@ -91,6 +91,8 @@ PIG-4639: Add better parser for Apache H BUG FIXES +PIG-4801: Provide backward compatibility with mapreduce mapred.task settings (rohini) + PIG-4759: Fix Classresolution_1 e2e failure (rohini) PIG-4800: EvalFunc.getCacheFiles() fails for different namenode (rohini) Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/tez/TezDagBuilder.java URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/tez/TezDagBuilder.java?rev=1729745&r1=1729744&r2=1729745&view=diff ============================================================================== --- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/tez/TezDagBuilder.java (original) +++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/tez/TezDagBuilder.java Wed Feb 10 21:37:05 2016 @@ -563,6 +563,8 @@ public class TezDagBuilder extends TezOp @SuppressWarnings("deprecation") Job job = new Job(payloadConf); payloadConf = (JobConf) job.getConfiguration(); + //TODO: Investigate. Setting as map writes empty output. + //payloadConf.setBoolean(MRConfig.IS_MAP_PROCESSOR, tezOp.isUseMRMapSettings()); payloadConf.setBoolean(MRConfiguration.MAPPER_NEW_API, true); payloadConf.setBoolean(MRConfiguration.REDUCER_NEW_API, true); payloadConf.setClass(MRConfiguration.INPUTFORMAT_CLASS, Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/tez/runtime/PigProcessor.java URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/tez/runtime/PigProcessor.java?rev=1729745&r1=1729744&r2=1729745&view=diff ============================================================================== --- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/tez/runtime/PigProcessor.java (original) +++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/tez/runtime/PigProcessor.java Wed Feb 10 21:37:05 2016 @@ -30,6 +30,8 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.mapred.TaskAttemptID; +import org.apache.hadoop.mapreduce.JobContext; import org.apache.pig.JVMReuseImpl; import org.apache.pig.PigConstants; import org.apache.pig.PigException; @@ -59,6 +61,7 @@ import org.apache.pig.impl.util.Utils; import org.apache.pig.tools.pigstats.PigStatusReporter; import org.apache.tez.common.TezUtils; import org.apache.tez.dag.api.UserPayload; +import org.apache.tez.mapreduce.hadoop.MRConfig; import org.apache.tez.mapreduce.output.MROutput; import org.apache.tez.runtime.api.AbstractLogicalIOProcessor; import org.apache.tez.runtime.api.Event; @@ -131,6 +134,22 @@ public class PigProcessor extends Abstra // To determine front-end in UDFContext conf.set(MRConfiguration.JOB_APPLICATION_ATTEMPT_ID, getContext().getUniqueIdentifier()); + + // For compatibility with mapreduce. Some users use these configs in their UDF + // Copied logic from the tez class - org.apache.tez.mapreduce.output.MROutput + // Currently isMapperOutput is always false. Setting it to true produces empty output with MROutput + boolean isMapperOutput = conf.getBoolean(MRConfig.IS_MAP_PROCESSOR, false); + TaskAttemptID taskAttemptId = org.apache.tez.mapreduce.hadoop.mapreduce.TaskAttemptContextImpl + .createMockTaskAttemptID(getContext().getApplicationId().getClusterTimestamp(), + getContext().getTaskVertexIndex(), getContext().getApplicationId().getId(), + getContext().getTaskIndex(), getContext().getTaskAttemptNumber(), isMapperOutput); + conf.set(JobContext.TASK_ATTEMPT_ID, taskAttemptId.toString()); + conf.set(JobContext.TASK_ID, taskAttemptId.getTaskID().toString()); + conf.setBoolean(JobContext.TASK_ISMAP, isMapperOutput); + conf.setInt(JobContext.TASK_PARTITION, + taskAttemptId.getTaskID().getId()); + conf.set(JobContext.ID, taskAttemptId.getJobID().toString()); + conf.set(PigConstants.TASK_INDEX, Integer.toString(getContext().getTaskIndex())); UDFContext.getUDFContext().addJobConf(conf); UDFContext.getUDFContext().deserialize();