Spark SQL - flatten Function

visibility 19 access_time 28 days ago languageEnglish timeline Stats
timeline Stats
Page index 0.66
more_horiz
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]


copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

More from Kontext
Spark SQL - Add Day, Month and Year to Date
visibility 19
thumb_up 0
access_time 13 days ago
Spark SQL - Map Functions
visibility 1,927
thumb_up 0
access_time 2 years ago
Spark SQL - LAG Window Function
visibility 6,386
thumb_up 0
access_time 2 years ago