Return-Path: X-Original-To: apmail-hadoop-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-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 3C7AB102CB for ; Thu, 30 Jan 2014 18:16:07 +0000 (UTC) Received: (qmail 5819 invoked by uid 500); 30 Jan 2014 18:15:52 -0000 Delivered-To: apmail-hadoop-user-archive@hadoop.apache.org Received: (qmail 5722 invoked by uid 500); 30 Jan 2014 18:15:51 -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 5711 invoked by uid 99); 30 Jan 2014 18:15:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jan 2014 18:15:51 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of idryman@gmail.com designates 209.85.192.172 as permitted sender) Received: from [209.85.192.172] (HELO mail-pd0-f172.google.com) (209.85.192.172) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jan 2014 18:15:45 +0000 Received: by mail-pd0-f172.google.com with SMTP id p10so3288444pdj.17 for ; Thu, 30 Jan 2014 10:15:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=PcV/YOAIdyF6CmioYXbRFxdOHqRFXMXJI75M4VHnWbs=; b=ftWmwNdHsiig/xDSeDvHxH8CERSHA5rp7kqNrcZwmGhFCtp87lohUriYaolSsHSSg1 EX+oUZMk0HdYDJe34bygMIPGLaHm4+6pcS3oDLPRKqPf2x4SJCWjeIvk1oE4kegz1rXj NuLU5ISpj7gV0EWcGpVbsl0i48lG9l2kHik6GmUS+HiHO7qAU/fh4aqvDgF9LFrK4FqP rdOoVEbOa8AEpIHGz9rDmL+arzbvIOAsG8BmMVLwEnsuHOUNvO0fPQHiEhAjC29PgWiI No/5qFUkNu59d22Bo1hehEaIsk4ZzfvfzBeRXdEq9sx/nVQsazx8shTJ7WNEq32Jd1Id iJRw== X-Received: by 10.68.180.66 with SMTP id dm2mr15623478pbc.143.1391105724692; Thu, 30 Jan 2014 10:15:24 -0800 (PST) Received: from [10.0.96.229] (198-24-198-253.static-ip.telepacific.net. [198.24.198.253]) by mx.google.com with ESMTPSA id nu10sm19647749pbb.16.2014.01.30.10.15.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Jan 2014 10:15:23 -0800 (PST) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: Capture Directory Context in Hadoop Mapper From: Felix Chern In-Reply-To: Date: Thu, 30 Jan 2014 10:15:28 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <00730058-BBF7-43A4-8975-771D2FC62B32@gmail.com> References: To: user@hadoop.apache.org X-Mailer: Apple Mail (2.1510) X-Virus-Checked: Checked by ClamAV on apache.org MultipleInputs is nice. Most of the time, I use it for reduce-side join. It's great, however, you'll need to specify different Mapper class per = input directory. In our case, we try to let the Mapper itself to capture the directory = information, because these directories might contain data across months, and the the file structures may differ a bit time by = time. Finally, this is the solution I came up with, and it's fun to hack on = lower level APIs. :D Yet, thanks for suggesting! Felix On Jan 29, 2014, at 10:15 PM, Harsh J wrote: > Hi, >=20 > These posts are nicely written - thanks for sharing! Have you also > taken a look at the MultipleInputs feature, which gives you a cleaner > approach? = http://hadoop.apache.org/docs/stable2/api/org/apache/hadoop/mapreduce/lib/= input/MultipleInputs.html >=20 > On Thu, Jan 30, 2014 at 4:16 AM, Felix Chern = wrote: >> Hi all, >>=20 >> I wrote a tutorial of how to receive path information in Mapper = class. It's >> useful in our hadoop use case where we need to apply different logic = on >> different input source directory. Enjoy! >>=20 >> = http://www.idryman.org/blog/2014/01/26/capture-directory-context-in-hadoop= -mapper/ >> = http://www.idryman.org/blog/2014/01/27/capture-path-info-in-hadoop-inputfo= rmat-class/ >>=20 >> Felix >=20 >=20 >=20 > --=20 > Harsh J