The explode_json_array_string table function accepts a JSON array. Its implementation logic is to convert the JSON array to an array type and then call the explode function for processing. The behavior is equivalent to: explode(cast(<json_array> as Array<STRING>)). It should be used together with LATERAL VIEW.
EXPLODE_JSON_ARRAY_STRING(<json>)
<json> JSON type, the content should be an array.<json>. The column type is Nullable<STRING>.<json> is NULL or an empty array (number of elements is 0), 0 rows are returned.create table example( k1 int ) properties( "replication_num" = "1" ); insert into example values(1);
select * from example lateral view explode_json_array_string('[4, "5", "abc", 5.23, null]') t2 as c;
+------+------+ | k1 | c | +------+------+ | 1 | 4 | | 1 | 5 | | 1 | abc | | 1 | 5.23 | | 1 | NULL | +------+------+
select * from example lateral view explode_json_array_string('[]') t2 as c;
Empty set (0.03 sec)
select * from example lateral view explode_json_array_string(NULL) t2 as c;
Empty set (0.03 sec)
select * from example lateral view explode_json_array_string('{}') t2 as c;
Empty set (0.03 sec)