Kontext Copilot - An AI-powered assistant for data analytics that runs on your local computer. Learn more
Get started
Spark SQL - flatten Function
insights Stats
warning Please login first to view stats information.
Kontext
Code Snippets & Tips
Code snippets and tips for various programming languages/frameworks. All code examples are under MIT or Apache 2.0 license unless specified otherwise.
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.
comment Comments
No comments yet.