Shivam
Shivam

Reputation: 45

How to read and separate non ascii character in a hive table column

How to separate the column value with comma,if column contains value like this format

ổ,đĩa,á,mh,có.

Output should be

ổ đĩa á mh có

Upvotes: 1

Views: 315

Answers (1)

leftjoin
leftjoin

Reputation: 38325

Use split function:

select splitted[0] as col1, 
       splitted[1] as col2,
       splitted[2] as col3,
       splitted[3] as col4,
       splitted[4] as col5
from
(
select split('ổ,đĩa,á,mh,có',',') as splitted
)s;

Returns:

OK
ổ       đĩa     á       mh      có
Time taken: 0.097 seconds, Fetched: 1 row(s)

It seems your comma is different. It is not ascii 44 character. After copy-paste comma from your string, it works fine:

 select split('Música,Padre-Hijo,Fe','‚') ;
OK
["MÃÃ","ºsicaïÃ","¼Ã","Å’Padre-HijoïÃ","¼Ã","Å’Fe"]

Upvotes: 1

Related Questions