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 1DF58110D1 for ; Fri, 11 Jul 2014 19:23:10 +0000 (UTC) Received: (qmail 93256 invoked by uid 500); 11 Jul 2014 19:23:08 -0000 Delivered-To: apmail-hive-user-archive@hive.apache.org Received: (qmail 93192 invoked by uid 500); 11 Jul 2014 19:23:08 -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 93182 invoked by uid 99); 11 Jul 2014 19:23:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jul 2014 19:23:08 +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 (athena.apache.org: domain of ramasubramanian.narayanan@gmail.com designates 209.85.192.178 as permitted sender) Received: from [209.85.192.178] (HELO mail-pd0-f178.google.com) (209.85.192.178) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jul 2014 19:23:02 +0000 Received: by mail-pd0-f178.google.com with SMTP id r10so1891701pdi.9 for ; Fri, 11 Jul 2014 12:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=wa3tMoRwW3jfjFQmjslGk5Bz2fjFRqZ+8AUT6s5G04U=; b=Y8veU1BRZSh3GPXvDYitgmaZAA+p/dXp2dIuWeIf4bUPv7R2ya/VWwTbXvTsMdoIqU nc9ErwkOzQZViZvlPi+kQbYaYOA39NZROJPVmhSWZvNqlVkipMlreQdfnaHNz2oigkWd ux8T3mslNJEcjz4UjArUR+YugBoKS2jRDb3YaEyj/YS1c/uDkuKbFmiw3fgQEJJtvfBd SekZZCgFfCof8Dmy4eP4w8tDgXVQJKw6IgHCBznQCNu2+QyO8gzApZ44uEUY96TYzmoa NAuLcPwhihkMcITVXlN8OBpv6db0Fs7LQMdudpvCQr91AJgnC9/KyPMWPlbLy94BThwc EIzA== X-Received: by 10.66.158.36 with SMTP id wr4mr937304pab.34.1405106561497; Fri, 11 Jul 2014 12:22:41 -0700 (PDT) Received: from static-167.123.96.14-tataidc.co.in ([14.96.123.167]) by mx.google.com with ESMTPSA id w7sm2415962pdo.90.2014.07.11.12.22.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jul 2014 12:22:40 -0700 (PDT) From: "N. Ramasubramanian" Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: inline query in the select clause Message-Id: Date: Sat, 12 Jul 2014 00:53:01 +0530 To: user@hive.apache.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) X-Mailer: Apple Mail (2.1878.2) X-Virus-Checked: Checked by ClamAV on apache.org Hi, I have below 2 tables=85 =20 1) create table dim (rank string,grade string) row format delimited = fields terminated by ',' stored as textile; Data: 1,1 2,1 3,1 4,2 5,2 6,2 7,3 2) create table fact (rollno string,name string,sub1 string,rank1 = string,sub2 string,rank2 string,sub3 string,rank3 string) row format = delimited fields terminated by ',' stored as textile; Data : 1,name1,english,1,maths,2,science,3 2,name2,english,5,maths,6,science,7 3,name1,english,7,maths,4,science,1 Below is the oracle query for which an equivalent query in HIVE is = needed. Is it possible to do without using UDF? The requirement display the grade instead of rank in the fact table=85. select a.rollno,a.name,a.sub1,(select grade from dim where rank =3D = a.rank1), a.sub2,(select grade from dim where = rank =3D a.rank2), a.sub3,(select grade from dim where = rank =3D a.rank3) from fact; Note : For simplicity have kept limited range/rows, actual requirement = has a very big range which cannot be hardcoded. regards, Rams=