>>> spark.sql("""
... SELECT map_from_entries(data) as result, typeof(map_from_entries(data)) as type
... from VALUES
...     (NULL), 
...     (
...         array(struct(1 as a, 'b' as b), 
...         struct(2 as a, NULL as b), 
...         struct(3 as a, 'd' as b))
...     ), 
...     (array()),
...     (cast(NULL as array<struct<a: int, b: string>>)) 
... as tab(data);
... """).show(truncate=False)
+---------------------------+---------------+
|result                     |type           |
+---------------------------+---------------+
|NULL                       |map<int,string>|
|{1 -> b, 2 -> NULL, 3 -> d}|map<int,string>|
|{}                         |map<int,string>|
|NULL                       |map<int,string>|
+---------------------------+---------------+

>>> spark.sql("""
... SELECT map_from_entries(data) as result, typeof(map_from_entries(data)) as type
... from values
...     (array(
...         struct(1 as a, "a" as b), 
...         cast(NULL as struct<a: int, b: string>), 
...         cast(NULL as struct<a: int, b: string>)
...     )),
...     (NULL),
...     (array(
...         struct(2 as a, "b" as b), 
...         struct(3 as a, "c" as b)
...     )),
...     (array(
...         struct(4 as a, "d" as b),
...         cast(NULL as struct<a: int, b: string>),
...         struct(5 as a, "e" as b),
...         struct(6 as a, "f" as b)
...     ))
... as tab(data);
... """).show(truncate=False)
+----------------+---------------+
|result          |type           |
+----------------+---------------+
|NULL            |map<int,string>|
|NULL            |map<int,string>|
|{2 -> b, 3 -> c}|map<int,string>|
|NULL            |map<int,string>|
+----------------+---------------+