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

Switch to Threaded View
Hive >> mail # user >> aliases for histogram_numeric (a UDTF)

Copy link to this message
aliases for histogram_numeric (a UDTF)
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 https://cwiki.apache.org/confluence/display/Hive/LanguageManual+LateralView  ?)

=========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.