}
// and next the additional order fields
for (int i = 0; i < additionalOrdering1.getNumberOfFields(); i++) {
Integer field = additionalOrdering1.getFieldNumber(i);
Order order = additionalOrdering1.getOrder(i);
this.ordering1.appendOrdering(field, additionalOrdering1.getType(i), order);
}
} else {
this.ordering1 = Utils.createOrdering(this.keys1);
}
// if we have an additional ordering, construct the ordering to have primarily the grouping fields
if (additionalOrdering2 != null) {
this.ordering2 = new Ordering();
for (Integer key : this.keys2) {
this.ordering2.appendOrdering(key, null, Order.ANY);
}
// and next the additional order fields
for (int i = 0; i < additionalOrdering2.getNumberOfFields(); i++) {
Integer field = additionalOrdering2.getFieldNumber(i);
Order order = additionalOrdering2.getOrder(i);
this.ordering2.appendOrdering(field, additionalOrdering2.getType(i), order);
}
} else {
this.ordering2 = Utils.createOrdering(this.keys2);
}