hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From P Reeder <>
Subject aliases for histogram_numeric (a UDTF)
Date Tue, 05 Nov 2013 22:21:29 GMT
I'm trying to use histogram_numeric(), and output the results as a table with an x and y column,
one row per bin.

SELECT histogram_numeric(freight, 10) from flights
produces an array of JSON objects:

select explode(histogram_numeric(freight, 10)) as foo from flights
produces ten rows of JSON objects:



select inline(histogram_numeric(freight, 10)) as foo from flights
gets the error "FAILED: SemanticException [Error 10083]: The number of aliases supplied in
the AS clause does not match the number of columns output by the UDTF expected 2 aliases but
got 1"
which is not unreasonable, since there should be two columns of output

select inline(histogram_numeric(freight, 10)) as foo,bar from flights
gets the error "FAILED: SemanticException 1:53 Only a single expression in the SELECT clause
is supported with UDTF's. Error encountered near token 'bar'"

select inline(histogram_numeric(freight, 10)) as [foo,bar] from flights
gets the error "FAILED: ParseException line 1:46 mismatched input 'as' expecting FROM near
')' in from clause"

select inline(histogram_numeric(freight, 10)) as (foo,bar) from flights
gets the error "java.lang.Exception: Total MapReduce CPU Time Spent: 6 seconds 30 msec: Job
0: Map: 1 Reduce: 1 Cumulative CPU: 6.03 sec HDFS Read: 17108227 HDFS Write: 0 FAIL"

Is there a syntax to do this, or do I need to use LATERAL VIEW syntax? (If so, is there a
clearer explanation of LATERAL VIEW than

This e-mail may contain privileged and confidential information which is the property of Persistent
Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed.
If you are not the intended recipient, you are not authorized to read, retain, copy, print,
distribute or use this message. If you have received this communication in error, please notify
the sender and delete all copies of this message. Persistent Systems Ltd. does not accept
any liability for virus infected mails.

View raw message