Added SortedOperation pattern to match *some* definitely sorted operations and avoid some sorting cost in HiveComparisonTest.
More HiveTableScan optimisations:

- Using mutable pairs
- Avoiding pattern matching (Array.unapply function calls)