Return-Path: X-Original-To: apmail-pig-dev-archive@www.apache.org Delivered-To: apmail-pig-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4AAA3F6D7 for ; Fri, 12 Apr 2013 19:10:17 +0000 (UTC) Received: (qmail 42397 invoked by uid 500); 12 Apr 2013 19:10:16 -0000 Delivered-To: apmail-pig-dev-archive@pig.apache.org Received: (qmail 42345 invoked by uid 500); 12 Apr 2013 19:10:16 -0000 Mailing-List: contact dev-help@pig.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pig.apache.org Delivered-To: mailing list dev@pig.apache.org Received: (qmail 42336 invoked by uid 500); 12 Apr 2013 19:10:16 -0000 Delivered-To: apmail-hadoop-pig-dev@hadoop.apache.org Received: (qmail 42333 invoked by uid 99); 12 Apr 2013 19:10:16 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Apr 2013 19:10:16 +0000 Date: Fri, 12 Apr 2013 19:10:16 +0000 (UTC) From: "Mythili Gopalakrishnan (JIRA)" To: pig-dev@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PIG-821) simulate NTILE(n) , rank() functionality in pig MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PIG-821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13630506#comment-13630506 ] Mythili Gopalakrishnan commented on PIG-821: -------------------------------------------- Basically what I would like to do is RANK Overall by Income and RANK by Income within each Industry. > simulate NTILE(n) , rank() functionality in pig > ----------------------------------------------- > > Key: PIG-821 > URL: https://issues.apache.org/jira/browse/PIG-821 > Project: Pig > Issue Type: New Feature > Components: impl > Affects Versions: 0.2.0 > Environment: mithril gold -gateway 4000 > Reporter: Rekha > Fix For: 0.11 > > > Hi, > I came across a job which has some processing which I cant seem to get easily over-the-counter from pig. > These are NTILE() /rank() operations available in oracle. > While I am trying to write a UDF, that is not working out too well for me yet.. :( > I have a ntile(n) over (partititon by x, y, z order by a desc, b desc) operation to be done in pig scripts. > Is there a default function in pig scripting which can do this? > For example, lets consider a simple example at http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/functions091.htm > So here, how would we ideally substitute NTILE() with? any pig counterpart function/udf? > SELECT last_name, salary, NTILE(4) OVER (ORDER BY salary DESC) > AS quartile FROM employees > WHERE department_id = 100; > > LAST_NAME SALARY QUARTILE > ------------------------- ---------- ---------- > Greenberg 12000 1 > Faviet 9000 1 > Chen 8200 2 > Urman 7800 2 > Sciarra 7700 3 > Popp 6900 4 > > In real case, i have ntile over multiple columns, so ideal way to find histograms/boundary/spitting out the bucket number is needed. > Similarly a pig function is required for rank() over(partition by a,b,c order by d desc) as e > Please let me know soon. > Thanks & Regards, > /Rekha -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira