cloudera/crunch — pull request #23 by tzolov (2012-05-10 12:55:27+00:00)
Title: Add PTable.values() method that returns a PCollection made up of the values in the table

The new PCollection.by(...) method converts collection into table. To compliment this method I have added the reverse method PTable.values() that returns collection of the values in the table. This should streamline/complete the syntax. For example one can sort a collection of complex Avro types by an arbitrary attribute like this:

PCollection unsorted = ...

MapFn nameExtractor = new MapFn() {
public String map(Person input) { return input.getName().toString(); }
};

PCollection sortedByName = unsorted	.by(nameExtractor, strings()).groupByKey().ungroup().values();

AvroTypeSortTest.java test the values method.