Return-Path: Delivered-To: apmail-hive-user-archive@www.apache.org Received: (qmail 49189 invoked from network); 9 Feb 2011 16:24:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Feb 2011 16:24:08 -0000 Received: (qmail 12645 invoked by uid 500); 9 Feb 2011 16:24:07 -0000 Delivered-To: apmail-hive-user-archive@hive.apache.org Received: (qmail 12323 invoked by uid 500); 9 Feb 2011 16:24:04 -0000 Mailing-List: contact user-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hive.apache.org Delivered-To: mailing list user@hive.apache.org Received: (qmail 12315 invoked by uid 99); 9 Feb 2011 16:24:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Feb 2011 16:24:04 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of njain@fb.com designates 66.220.144.132 as permitted sender) Received: from [66.220.144.132] (HELO mx-out.facebook.com) (66.220.144.132) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Feb 2011 16:23:57 +0000 Received: from [192.168.18.212] ([192.168.18.212:8524] helo=mail.thefacebook.com) by mta001.snc4.facebook.com (envelope-from ) (ecelerity 2.2.2.45 r(37388)) with ESMTP id 44/2E-22156-28FB25D4; Wed, 09 Feb 2011 08:23:30 -0800 Received: from SC-MBX01-3.TheFacebook.com ([fe80::ed71:3809:487b:e7cc]) by sc-hub04.TheFacebook.com ([192.168.18.212]) with mapi id 14.01.0218.012; Wed, 9 Feb 2011 08:23:30 -0800 From: Namit Jain To: "user@hive.apache.org" Subject: Re: for each partition Thread-Topic: for each partition Thread-Index: AcvIFexjayeFrvrRDUmM+rTjPvZyaQABPfETACIXuAD//6TlAA== Date: Wed, 9 Feb 2011 16:23:30 +0000 Message-ID: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.0.0.100825 x-originating-ip: [192.168.18.252] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 You can use dynamic partitioning: insert overwrite table item_view_aggregate partition (date_hour) select iv.sid, count(*), date_hour from item_view iv where (iv.date_hour=3D'2011310116' or date_hour=3D''' or date_hour=3D'.....) group by iv.sid, date_hour; On 2/9/11 5:49 AM, "Cam Bazz" wrote: >Well, I designed my dataflow to work incrementally based on >partitions. But I have a number of datafiles now, >and for the first run, I have to for example: > >insert overwrite table item_view_aggregate partition >(date_hour=3D2011310116) select iv.sid, count(*) from item_view iv where >iv.date_hour=3D'2011310116' group by iv.sid; > >.. > >I have to repeat this for each partition. so I need something like a >for loop, or do it with an external program. > >best regards, >-c.b. > >On Wed, Feb 9, 2011 at 7:33 AM, Christopher, Pat > wrote: >> If you want to operate over all partitions in a table you don't need to >>specify the partitions at all. Run your query and enjoy! >> >> If you want to specify the partition mapping of the output dataset from >>a query, I think you can derive that value on a per row basis like so: >> >> Partition=3Dsubstr(dateval,1,14) >> >> Assuming dateval is a field in your table and partition is your >>partition field. >> >> Lemme know if you need more or if it doesn't work. I'll check it out >>tomorrow at work. >> >> Pat >> >> >> >> -- Sent from my Palm Pre >> >> ________________________________ >> On Feb 8, 2011 8:57 PM, Cam Bazz wrote: >> >> Hello, >> >> How can I do some process for each partition in some other table. >> >> for example lets say table A has partitions 1,2,3 >> >> I want to be able to say >> >> for each partition in A do { >> select * from A where partition is ? into some othertable where >>partition is ? >> } >> >> Best Regards, >> C.B. >>