You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by "Narla,Venkatesh" <Ve...@Cerner.com> on 2013/10/17 23:44:23 UTC

Performing MULTIPLE DISTINCTS on Columns using Hive

Hello,

I  am using Hive to analyze some data. As part of my hive queries I am trying to do Distinct  select on different columns and I am not able to get that well.

I am performing explode on data as its type is array<struct>. I am not able to


Select DISTINCT (lateral_test.id, lateral_test.person.datetime) from hive_test LATERAL VIEW EXPLODE(key.data) explodedtable as lateral_test  where key.id=1 and key.prson=test
And lateral_test.person.datetime=12345669


Exception:

FAILED: ParseException line 1:37 missing ) at ',' near '<EOF>'
line 1:84 extraneous input ')' expecting FROM near '<EOF>'


I have also tried this way by modifying my query.


Select DISTINCT (lateral_test.id), DISTINCT(lateral_test.person.datetime) from hive_test LATERAL VIEW EXPLODE(key.data) explodedtable as lateral_test  where key.id=1 and key.prson=test
And lateral_test.person.datetime=12345669




Exception:


FAILED: ParseException line 1:40 cannot recognize input near 'DISTINCT' '(' 'result_data' in select expression

I would appreciate if any body could guide me where I am doing wrong or how I should be able to proceed with that. Thank you for your time.


Regards,
VN

CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.