Currently a global
SORT(ds, a, b)
in thor implies that each unique combination of (a,b) must end up on the same node. There are situations where it would be useful for the distribution to be a subset of the sort criteria. E.g.,
CHOOSEN(GROUP(SORT(ds, a, -cnt), a, 20, GROUPED);
We could add an extra DISTRIBUTE() flag on SORT to indicate which fields must be on the same node.
SORT(ds, a, b, c, DISTRIBUTE(a,b))
or just as easily it could indicate the trailing field
SORT(ds, a, b, c, DISTRIBUTE(b))
If there was no argument that could imply that no distribution was required.