private static <T> GroupingOptions buildGroupingOptions(Configuration conf, PTypeFamily tf, PType<T> ptype,
ColumnOrder[] columnOrders) {
Builder builder = GroupingOptions.builder();
if (tf == WritableTypeFamily.getInstance()) {
TupleWritableComparator.configureOrdering(conf, columnOrders);
builder.sortComparatorClass(TupleWritableComparator.class);
} else if (tf == AvroTypeFamily.getInstance()) {
TupleAvroComparator.configureOrdering(conf, columnOrders, ptype);
builder.sortComparatorClass(TupleAvroComparator.class);
} else {
throw new RuntimeException("Unrecognized type family: " + tf);