}
private IndexCompGen generateTableJoins() {
final List<Table> tableList = _pq.getTableList();
final TableSelector ts = new TableSelector(tableList, _schema, _pq.getTan());
final JoinTablesExprs jte = _pq.getJte();
final IndexCompGen cg = new IndexCompGen(_schema, _pq, _map);
// first phase
// make high level pairs
final List<String> skippedBestTableNames = new ArrayList<String>();
final int numTables = tableList.size();
if (numTables == 1) {
cg.generateDataSource(ParserUtil.getComponentName(tableList.get(0)));
return cg;
} else {
final int highLevelPairs = getNumHighLevelPairs(numTables);
for (int i = 0; i < highLevelPairs; i++) {
final String bestTableName = ts.removeBestTableName();
// enumerates all the tables it has joinCondition to join with
final List<String> joinedWith = jte.getJoinedWith(bestTableName);
// dependent on previously used tables, so might return null
final String bestPairedTable = ts.removeBestPairedTableName(joinedWith);
if (bestPairedTable != null) {
// we found a pair
final DataSourceComponent bestSource = cg.generateDataSource(bestTableName);