private Column undeclaredHKeyColumn(HKeyColumn hKeyColumn) { Column undeclaredHKeyColumn = null; int rootMostDepth = rootMostTable().getDepth(); List<Column> equivalentColumns = hKeyColumn.equivalentColumns(); switch (getJoinType()) { case LEFT: // use a rootward bias, but no more rootward than the rootmost table for (Column equivalentColumn : equivalentColumns) { int equivalentColumnDepth = equivalentColumn.getTable().getDepth(); if (undeclaredHKeyColumn == null && equivalentColumnDepth >= rootMostDepth) { undeclaredHKeyColumn = equivalentColumn; } } break; case RIGHT: // use a leafward bias, but no more leafward than the leafdmost table int leafMostDepth = leafMostTable().getDepth(); for (ListIterator<Column> reverseCols = equivalentColumns.listIterator(equivalentColumns.size()); reverseCols.hasPrevious(); ) { Column equivalentColumn = reverseCols.previous(); int equivalentColumnDepth = equivalentColumn.getTable().getDepth(); if (undeclaredHKeyColumn == null && equivalentColumnDepth <= leafMostDepth) { undeclaredHKeyColumn = equivalentColumn; } } break; } if (undeclaredHKeyColumn == null) { undeclaredHKeyColumn = hKeyColumn.column(); } return undeclaredHKeyColumn; }
private static int columnPosition( Map<? extends Table, Integer> flattenedRowOffsets, Column column) { int position = column.getPosition(); Integer offset = flattenedRowOffsets.get(column.getTable()); if (offset == null) { throw new NullPointerException( "no offset for " + column.getTable() + " in " + flattenedRowOffsets); } position += offset; return position; }
public void markInvolvedInIndex(Column column) { assert column.getTable() == table; inIndex.set(column.getPosition(), true); }
private int depth(Column column) { return column.getTable().getDepth(); }