Created on 09-03-2018 02:04 AM - edited 09-16-2022 06:39 AM
I have data as source as below. How to transform the multi rows?
Any function like lateral view explode in impala?
Created 09-11-2018 11:16 AM
Created 11-09-2022 02:46 AM
Is it supported now?
Created 01-05-2024 07:56 AM
Do we have any alternative for this to do in impala or introduced any function to support in any newer version of impala?
Thanks
Created 01-16-2024 01:49 PM
There is a workaround to solve this. Is not a definitive solutions but it can help:
The final result would be like this:
insert overwrite t_1
select 'Asia' as cont,'Japan;China;Singapore;' Country_list union
select 'Europe' as cont,'UK;Spain;Italy;German;Norway;' Country_list
CREATE EXTERNAL TABLE IF NOT EXISTS t_transpose (
field_transpose string
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ";"
STORED AS TEXTFILE;
insert overwrite t_transpose
select REGEXP_REPLACE(Country_list, ';', concat("|", cont, '\n' ) ) as transpose
from t_1;
select split_part(field_transpose,"|",1), split_part(field_transpose,"|",2) from t_transpose;
Ps: The final result could have some blank lines, just filter/ignore it. I also put one more ";" in the line comparing with the example informed.