Assemble sort keys into an array, and pick them out, each with correct orderType

Fixes many cases, including the example given in #107.

Many other queries currently trip up the planner, including when filtering is present; see the pending tests included in this PR.
Is this the only case not handled? Would prefer to get this handled too in the same PR since it's covered by the same ticket.