Or Is it good idea to get data into shell variable/file and doing processing. 
Or using a pig script to do?

hive -e 'select distinct(columnA), distinct(columnB)  from blah' | sed 
's/[\t]/,/g' >/tmp/test

Thanks,
Chandra


From: Bogala, Chandra Reddy [Tech]
Sent: Wednesday, January 08, 2014 5:49 PM
To: 'user@hive.apache.org'
Subject: merge columns and count no of records

Hi,
My requirement is to merge ( not concat )  two columns and count number of 
distinct records. I can use self-join on column A and column B and can count 
number of records.
But  looks not optimal way of doing. Is there any better way to do.

Ex: Original table
Column A

COLUMN B

1

2

2

3

5

6

4

7

1

2

4

2


Logic something like this: Count(Distinct(Merge (distinct(A),distinct(B))))
Query OUTPUT should be :7
Values {1,2,3,4,5,6,7}

Thanks,
Chandra

Reply via email to