ARRAY_SORTBY
Learn how to use the ARRAY_SORTBY array function in PlaidCloud Lakehouse. Sorts elements of one array by corresponding elements of another array.
Sorts elements of one array by corresponding elements of another array.
Analyze Syntax
func.array_sortby(get_column(table, 'names'), get_column(table, 'scores'))
Analyze Examples
func.array_sortby(['c','a','b'], [3,1,2])
┌───────────────┐
│ ['a','b','c'] │
└───────────────┘
SQL Syntax
ARRAY_SORTBY(<names>, <scores>)
SQL Examples
SELECT ARRAY_SORTBY(['c','a','b'], [3,1,2]);
┌───────────────┐
│ ["a","b","c"] │
└───────────────┘