A TeraSort implementation for the current DataSet API would look a bit different from the deprecated Record API.
Flink doesn't support automatic range partitioning, but by using a custom partitoner (DataSet.partitionCustom()) which range partitions (distribution of values is known) and a subsequent DataSet.sortPartition() you can do a global sort and implement a TeraSort program.
Just drop a mail if you have further questions.
Cheers, Fabian