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

Switch to Threaded View
HBase, mail # user - HBase table - distinct values


Copy link to this message
-
Re: HBase table - distinct values
Jean-Marc Spaggiari 2012-10-10, 11:52
Hi Raviprasad,

What you can do, if deptno is you key, or the first part of you key,
is to scan for the first entry, then increment it by one and scan with
this value.

Let's take an example.

Key format is DEPTNO + ID (XXYY)
You table content is:
0101
0102
0106
0207
0212
0243
0419
0441

If you scan for the first entry you will find 0101. You extract 01
form that. Then you search for the next DEPTID just above this one.
You first key for the search will be 02. And you will find 0207. You
do the same. Start key for your search will be 03 and you will find
04.

And so on.

the main issue you will have is that is you have only few DEPTNO, you
will hotspot one server, then another one, and so on. So may you
should think about your schema first. Like you can have a table with
only the deptno so to get the list of distincts deptno you just scan
this table? etc.

JM

2012/10/10, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> Hi all,
>   Is it possible to select distinct value from Hbase table.
>
> Example :-
>    what is the equivalant code for the below Oracle code  in Hbase  ?
>
>   Select count (distinct deptno) from emp ;
>
> Regards
> Raviprasad. T
>
>
> This e-Mail may contain proprietary and confidential information and is sent
> for the intended recipient(s) only.  If by an addressing or transmission
> error this mail has been misdirected to you, you are requested to delete
> this mail immediately. You are also hereby notified that any use, any form
> of reproduction, dissemination, copying, disclosure, modification,
> distribution and/or publication of this e-mail message, contents or its
> attachment other than by its intended recipient/s is strictly prohibited.
>
> Visit us at http://www.polarisFT.com
>