Shubham Venayak
Shubham Venayak

Reputation: 41

Concat_ws not working in insert statement in hive

Using hive, I'm trying to concatenate columns from one table and insert them in another table using the query

insert into table temp_error 
select * from (Select 'temp_test','abcd','abcd','abcd',
from_unixtime(unix_timestamp()),concat_ws('|',sno,name,age)
from temp_test_string)c;

I get the required output till I use Select *. But as soon as I try to insert it into the table, it does not give concatenated output but gives the value of sno only instead of whole concatenated output.

Upvotes: 0

Views: 1070

Answers (1)

Shubham Venayak
Shubham Venayak

Reputation: 41

Thanks guys. I found why it was behaving that way. It's because while creating table I gave "separate fields by '|'". So what I was trying to insert as a string into the table, hive was interpreting it as different columns.

Upvotes: 0

Related Questions