Kontext Kontext

Spark SQL - flatten Function

event 2022-05-31 visibility 851 comment 0 insights toc
more_vert
insights Stats
toc Table of contents
Spark SQL - flatten Function

As many other programming frameworks, flatten is usually used to translate an array of arrays to a single array. In Spark SQL, a built in function flatten can be used to flatten arrays.

Code snippet

SELECT flatten(array(array(1, 2), array(3, 4, 5), array(6, 7), array(8)));
Results:
[1,2,3,4,5,6,7,8]


More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts