Return-Path: Delivered-To: apmail-lucene-hadoop-user-archive@locus.apache.org Received: (qmail 98184 invoked from network); 28 Aug 2007 17:46:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Aug 2007 17:46:03 -0000 Received: (qmail 89406 invoked by uid 500); 28 Aug 2007 17:45:57 -0000 Delivered-To: apmail-lucene-hadoop-user-archive@lucene.apache.org Received: (qmail 89374 invoked by uid 500); 28 Aug 2007 17:45:57 -0000 Mailing-List: contact hadoop-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hadoop-user@lucene.apache.org Delivered-To: mailing list hadoop-user@lucene.apache.org Received: (qmail 89365 invoked by uid 99); 28 Aug 2007 17:45:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Aug 2007 10:45:57 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [216.145.54.171] (HELO mrout1.yahoo.com) (216.145.54.171) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Aug 2007 17:46:44 +0000 Received: from afterside.corp.yahoo.com (afterside.corp.yahoo.com [10.72.110.226]) by mrout1.yahoo.com (8.13.6/8.13.6/y.out) with ESMTP id l7SHjD6R006184; Tue, 28 Aug 2007 10:45:13 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; s=serpent; d=yahoo-inc.com; c=nofws; q=dns; h=message-id:date:from:user-agent:mime-version:to:cc:subject: references:in-reply-to:content-type:content-transfer-encoding; b=LPD2pyJwoFgJBhAjUUZ/eACeJEjx4O7oPgnEJlT8CzZI9ry7Io/aCEAKm7EdxDFp Message-ID: <46D45F29.4050009@yahoo-inc.com> Date: Tue, 28 Aug 2007 10:45:13 -0700 From: Alan Gates User-Agent: Thunderbird 2.0.0.6 (X11/20070728) MIME-Version: 1.0 To: hadoop-user@lucene.apache.org CC: utkarsh@yahoo-inc.com Subject: Re: looking for some help with pig syntax References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I think the following will do what you want. t1 = load table1 as id, listOfId; t2 = load table2 as id, f1; t1a = foreach t1 generate flatten(listOfId); -- flattens the lisOfId into a set of ids b = join t1a by $0, t2 by id; -- join the two together. c = foreach b generate t2.id, t2.f1; -- project just the ids and f1 entries. Alan. Joydeep Sen Sarma wrote: > Specifically, how can we express this query: > > > > Table1 contains: id, (list of ids) > > Table2 contains: id, f1 > > > > Where the Table1:list is a variable length list of foreign key (id) into > Table2. > > > > We would like to join every element of Table1:list with corresponding > Table2:id. Ie. The final output should of the form: > > > > Table3 contains: id, (list of f1) > > > > Couldn't quite figure out how to do this - does Pig Latin support nested > foreach loops? If there's a more appropriate mailing list - please > re-direct, > > > > Thanks, > > > > Joydeep > > > > > > >