Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive, mail # user - collect_set question


Copy link to this message
-
Re: collect_set question
Sanjay Subramanian 2013-05-17, 19:30
Hi
The Hive Programming Book explains how to implement a "collect" function that returns a list (instead of set)  of objects…perhaps u can tweak this to return the N number of items in List
Thanks
sanjay
From: Robert Li <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Reply-To: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Date: Friday, May 17, 2013 12:25 PM
To: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Subject: collect_set question

For collect_set is it possible to only collect a few elements and then stop? For example

Select user,collect_set(timestamp)
from XYZ
group by user.

For each user, there could be hundreds of timestamps, but I only need 3 or 4 per user. Is there a way to tell collect_set to stop collecting after it's reached a certain number of elements?

--

Robert Li | Integration and Support Engineer  | Kontagent

Kontagent is Hiring!<http://www.kontagent.com/why/careers/> | Check us out in the press!<http://www.kontagent.com/why/news/>
Check out our blog: kScope<http://kaleidoscope.kontagent.com/> | Twitter: @Kontagent<http://www.twitter.com/kontagent>

CONFIDENTIALITY NOTICE
=====================This email message and any attachments are for the exclusive use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message along with any attachments, from your computer system. If you are the intended recipient, please be advised that the content of this message is subject to access, review and disclosure by the sender's Email System Administrator.