Return-Path: X-Original-To: apmail-hadoop-mapreduce-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-mapreduce-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2C980E4C5 for ; Sat, 15 Dec 2012 10:18:13 +0000 (UTC) Received: (qmail 15139 invoked by uid 500); 15 Dec 2012 10:18:08 -0000 Delivered-To: apmail-hadoop-mapreduce-user-archive@hadoop.apache.org Received: (qmail 14902 invoked by uid 500); 15 Dec 2012 10:18:07 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 14882 invoked by uid 99); 15 Dec 2012 10:18:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Dec 2012 10:18:06 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sigurd.spieckermann@gmail.com designates 209.85.210.48 as permitted sender) Received: from [209.85.210.48] (HELO mail-da0-f48.google.com) (209.85.210.48) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Dec 2012 10:18:00 +0000 Received: by mail-da0-f48.google.com with SMTP id k18so1792978dae.35 for ; Sat, 15 Dec 2012 02:17:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=aw+JZyCd0cYu00lh+GL+tQB2uL4NOr7nWCAF/guUmF0=; b=s0XRZvq8K5WK11MiMKcog+cvlSHWNczjW28IOhmsbBxcPo95dyXK4QxW+5+QxK5qNz uIRXlVzvWkr54pXz1zjlneU9xA6SLN+SQtPQnZXJkmoJjG8KimolxTZc9voCaztQua2d KztkfzjJv5/EY2Sgl3trm4wfRZMN7fTnnPRnmd2EvHX7MylJyrf5l4HV3cg1Bd0X0Fuw jrUckBkYI+uZ/03R1/CETlzuohx+YqMKz+reSCoyG+o72KXm0DxF96wbpQo7ViNDvhRG I0BJCWmtWYyNnFyAGKlfzTuMzhrc9MtvtoP7kUQ7PrndAlE5jCjIsYeDUuCgj3CscPFV X2rQ== MIME-Version: 1.0 Received: by 10.66.84.3 with SMTP id u3mr23445197pay.51.1355566659834; Sat, 15 Dec 2012 02:17:39 -0800 (PST) Received: by 10.68.41.35 with HTTP; Sat, 15 Dec 2012 02:17:39 -0800 (PST) Received: by 10.68.41.35 with HTTP; Sat, 15 Dec 2012 02:17:39 -0800 (PST) In-Reply-To: References: Date: Sat, 15 Dec 2012 11:17:39 +0100 Message-ID: Subject: Re: how to differentiate which input directory current record comes from? From: Sigurd Spieckermann To: user@hadoop.apache.org Content-Type: multipart/alternative; boundary=f46d042f94703a952904d0e175d0 X-Virus-Checked: Checked by ClamAV on apache.org --f46d042f94703a952904d0e175d0 Content-Type: text/plain; charset=ISO-8859-1 If you use the new API, you can access the MapContext object in the setup method of the mapper. Then, you can get the input split with MapContext#getInputSplit(), cast it to FileSplit and obtain the path of the file the current split is part of through the FileSplit#getPath() method. All records of the mapper instance will be part of that split so you only need to get the information once per map task in the setup method. Am 14.12.2012 19:46 schrieb "Xiaowei Li" : > hi, > > my MR job has multiple inputs, and I wanna how to differentiate which > input directory current row/record comes from in my mapper? > > thanks! > -xw > --f46d042f94703a952904d0e175d0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

If you use the new API, you can access the MapContext object= in the setup method of the mapper. Then, you can get the input split with = MapContext#getInputSplit(), cast it to FileSplit and obtain the path of the= file the current split is part of through the FileSplit#getPath() method. = All records of the mapper instance will be part of that split so you only n= eed to get the information once per map task in the setup method.

Am 14.12.2012 19:46 schrieb "Xiaowei Li&quo= t; <selluck@gmail.com>:
hi,=A0

my MR job has multiple inputs, and I wanna how to= differentiate which input directory current row/record comes from in my ma= pper?

thanks!
-xw
--f46d042f94703a952904d0e175d0--