I have a hive table like below. The number of elements of each column is unpredictable. Can anyone tell me how to explode all columns of this table correctly without loosing the Null values.
+-------------------------------+-------------------+----------------------------+--+
| l1.skillcode | l1.duration | l1.numberofpeople |
+-------------------------------+-------------------+----------------------------+--+
| ["ACFC"] | ["00020"] | ["1"] |
| ["ACFC"] | ["00233"] | ["1"] |
| ["AJBS"] | ["00605"] | ["1"] |
| ["ACFC"] | ["00020"] | ["1"] |
| ["TESTING"] | ["123456"] | ["09876"] |
| ["ACFC"] | ["00233","846"] | ["1"] |
| ["AJBS"] | ["00605"] | ["1"] |
| ["ACFC"] | ["00020"] | ["1"] |
| ["TESTING"] | NULL | ["09876"] |
| ["ACFC"] | ["00233"] | NULL |
| ["AJBS"] | ["00605"] | ["1"] |
| ["ACFC"] | ["00020"] | ["1"] |
| ["TESTING"] | NULL | ["09876","09877","09878"] |
| NULL | ["56743"] | ["45678","345"] |
| ["ACFC","BES","SAL","EPD"] | ["00233"] | ["1"] |
| ["AJBS"] | ["00605"] | ["1"] |
| NULL | ["00020"] | ["1"] |
| ["TESTING"] | NULL | ["09876","09877","09878"] |
| NULL | ["56743"] | ["45678","345"] |
| ["ACFC"] | ["00020"] | ["1"] |
| ["TESTING"] | NULL | ["09876","09877","09878"] |
| ["ACFC"] | ["00233"] | ["1"] |
| ["AJBS"] | ["00605"] | ["1"] |
+-------------------------------+-------------------+----------------------------+--+
When i try below, i get the null values of the column that i am trying to explode and the associated non-null values of that row removed.
select L2.*,t1.duration,t1.numberofpeople from t1
lateral view explode(t1.skillcode) L2;
How to explode all columns of the table without loosing any NULL values and also maintain the relationship between the values of all the 3 columns.