Revert "Replace sortBy intermediate array with CloudArray"

This reverts commit 2a394170967f48c488c6030c4e73be1f57fe2f43.
Revert