Return-Path: X-Original-To: apmail-hive-user-archive@www.apache.org Delivered-To: apmail-hive-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7BADE4A88 for ; Sun, 12 Jun 2011 22:49:05 +0000 (UTC) Received: (qmail 54680 invoked by uid 500); 12 Jun 2011 22:49:04 -0000 Delivered-To: apmail-hive-user-archive@hive.apache.org Received: (qmail 54618 invoked by uid 500); 12 Jun 2011 22:49: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 54610 invoked by uid 99); 12 Jun 2011 22:49:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Jun 2011 22:49: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 (nike.apache.org: domain of snaik@attributor.com designates 209.85.218.48 as permitted sender) Received: from [209.85.218.48] (HELO mail-yi0-f48.google.com) (209.85.218.48) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Jun 2011 22:48:57 +0000 Received: by yic24 with SMTP id 24so1293568yic.35 for ; Sun, 12 Jun 2011 15:48:36 -0700 (PDT) Received: by 10.236.177.72 with SMTP id c48mr6174360yhm.166.1307918916094; Sun, 12 Jun 2011 15:48:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.147.171.6 with HTTP; Sun, 12 Jun 2011 15:48:16 -0700 (PDT) In-Reply-To: <4F6B25AFFFCAFE44B6259A412D5F9B1032B8A5FC@ExchMBX104.netflix.com> References: <4F6B25AFFFCAFE44B6259A412D5F9B1032B8A5FC@ExchMBX104.netflix.com> From: sagar naik Date: Sun, 12 Jun 2011 15:48:16 -0700 Message-ID: Subject: Re: left outer join on same table To: user@hive.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Thxs Igor Trick is to get where conditions in join condition Thxs again -Sagar On Sat, Jun 11, 2011 at 5:01 PM, Steven Wong wrote: > I think you can also move the condition T2.field6=3D'yyyyyyy' into the ON > clause. > > > > > > From: Igor Tatarinov [mailto:igor@decide.com] > Sent: Friday, June 10, 2011 9:31 PM > To: user@hive.apache.org > Subject: Re: left outer join on same table > > > > The condition=A0T2.field6=3D'yyyyyyy;' is tested after the outer join. As= a > result you won't see any non-matching results. > > You'll need a subquery to enforce that condition. Alternatively, adding '= OR > T2.field6 IS NULL' might work for you too. Just make sure to use parens > around the OR clause. But that's probably not what you want - then, use a > subquery. > > > > On Fri, Jun 10, 2011 at 6:55 PM, sagar naik wrote: > > Hi , > > I am trying to do join on same table. > I wanted to do a left outer join > However, the results are not like left outer join( with no null values) > > select T1.field1, T1.field2, T1.field3 > =A0 =A0 =A0 =A0 =A0T2.field10 > =A0 =A0 =A0 =A0 =A0from table T1 > =A0 =A0 =A0 =A0 =A0left outer join table T2 on (T1.key=3DT2.key and > T1.partition=3D'p1' and T2.partition=3D'p2') > =A0 =A0 =A0 =A0 =A0 where > =A0 =A0 =A0 =A0 =A0 T1.field5=3D'xxxxx' and T2.field6=3D'yyyyyyy;' > > > I tried left/full =A0all join result are like =A0inner join. > What am I missing here ? > =A0is it some mistake on my part or some optimization /flag to be turned = off > > Thanks for the help > > > > -Sagar > >