Closed eruizalo closed 1 year ago
It would be nice to have a function to sort arrays of structs by column names
Currently and until array_sort function with lambda is released, we have to create our own spark function or use an expression:
expr("array_sort(value, (l, r) -> case " + // name ASC "when l.name < r.name then -1 " + "when l.name > r.name then 1 " + "else ( case" + // age DESC " when l.age > r.age then -1 " + " when l.age < r.age then 1 " + " else 0 end " + ") end)" )
Feature suggestion
It would be nice to have a function to sort arrays of structs by column names
Current behaviour
Currently and until array_sort function with lambda is released, we have to create our own spark function or use an expression: