shuffle function
Applies to: Databricks SQL
Databricks Runtime
Returns a random permutation of the array in expr.
Syntax
shuffle(expr)
Arguments
expr: AnARRAYexpression.
Returns
The result type matches the type expr.
This function is non-deterministic.
Examples
SQL
> SELECT shuffle(array(1, 20, 3, 5));
[3,1,5,20]
> SELECT shuffle(array(1, 20, NULL, 3));
[20,NULL,3,1]