Explode in Hive is used to convert complex data types into desired table formats. explode UDTF basically emits all the elements in an array into multiple rows.
It gives lateral view.
Explode() takes in an array (or a map) as an input and gives the elements of the array (map) as separate rows for output.
create table test (
item MAP<STRING, STRING>
);
Want to iterate all the items inside the MAP as key-value pairs.Hive offered such function called explode():
Ex-SELECT explode(myCol) AS myNewCol FROM test;
Copyright ©2022 coderraj.com. All Rights Reserved.