Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
Reviewed
Description
When explode() is called on rows where the array column is null, a null pointer exception is thrown.
For example consider having a table named test with the following rows
key value
1 [1,2,3]
2 null
Then running the query
SELECT explode(value) AS myCol FROM test; or SELECT * FROM test LATERAL VIEW explode(value) myTab AS myCol;
will throw a null pointer exception when explode() gets the null value from the 2nd row.
Possible options are:
1. Treat null values as an error and make the user fix null values in data
2. explode(null) generates a null output value.
3. explode(null) generates no output values
#2 means that explode(null) and explode(array(null)) will behave identically. Because of that, I think #3 makes the most sense.