I have a table as below:
user_id email
u1 e1, e2
u2 null
My goal is to convert this into the following format:
user_id email
u1 e1
u1 e2
u2 null
HIVE sql: select * FROM table LATERAL VIEW explode ( split ( email ,',' ) ) email AS email_id
When above query is executed in hive I am getting the nulls however when the same is ran in spark-sql I am not getting nulls, this question and scenario has already been discussed here
Spark sql
:
select * FROM table LATERAL VIEW OUTER explode ( split ( email ,',' ) ) email AS email_id;
select * from table lateral view POSEXPLODE_OUTER(split(email,',')) email as email_id <br>
The second is failing with syntax issue, I tried searching for lateral view with posexplode_outer but could not get much results, I want to bring nulls in spark-sql.
posexplode_outer
isn't valid. – Vamsi Prabhala