Added "partitionBy" with generics.
Optimizations and hint/lint pass.