Jeyhun Karimov
Jeyhun Karimov

Reputation: 1295

Hive histogram_numeric function outputs invalid character

I am using histogram_numeric function of hive and I want to output my select query to file. However I get invalid characher in file and i cannot use it for plotting the data.

here is my code:

INSERT OVERWRITE LOCAL DIRECTORY '/home/cloudera/queries/histograms/q1'
      ROW FORMAT DELIMITED                                                           
      FIELDS TERMINATED BY ','                                                       
     select explode(histogram_numeric(operationTime,30)) from transaction;   

And as a result I get :

3.1968591661070107"someInvalidCharacter"196572.0
14.41629947203365"someInvalidCharacter"725191.0
27.84241052482667"someInvalidCharacter"27069.0

But I expect "," instead of "someInvalidCharacter".

What can be the problem

Upvotes: 0

Views: 2115

Answers (1)

o-90
o-90

Reputation: 17593

Per the Hive LanguageManual, histogram_numeric creates an array of structs. Trying using inline to "explode" your output instead of using explode.

Upvotes: 1

Related Questions