for (int i = 0; i < ancestors.length - 1; i++) {
Row ancestor = ancestors[i];
if (ancestor != null) {
// We may have remembered an ancestor with no
// children and then this row is an orphan.
if (ancestor.ancestorOf(row)) {
addFields(ancestor, fieldsByRowType.get(ancestor.rowType()));
}
else {
ancestors[i] = null;
}