private StmtTargetTableScan addSimplifiedSubqueryToStmtCache(
            StmtSubqueryScan subqueryScan, StmtTargetTableScan tableScan) {
        String tableAlias = subqueryScan.getTableAlias();
        assert(tableAlias != null);
        // It is guaranteed by the canSimplifySubquery that there is
        // one and only one TABLE in the subquery's FROM clause.
        Table promotedTable = tableScan.getTargetTable();
        StmtTargetTableScan promotedScan =
                new StmtTargetTableScan(promotedTable, tableAlias, m_stmtId);
        // Keep the original subquery scan to be able to tie the parent
        // statement column/table names and aliases to the table's.
        promotedScan.setOriginalSubqueryScan(subqueryScan);
        // Replace the subquery scan with the table scan
        StmtTableScan prior = m_tableAliasMap.put(tableAlias, promotedScan);
        assert(prior == subqueryScan);
        m_tableList.add(promotedTable);
        return promotedScan;
    }
private StmtTargetTableScan addSimplifiedSubqueryToStmtCache ( StmtSubqueryScan subqueryScan , StmtTargetTableScan tableScan ) { String tableAlias = subqueryScan . getTableAlias ( ) ; assert ( tableAlias != null ) ; Table promotedTable = tableScan . getTargetTable ( ) ; StmtTargetTableScan promotedScan = new StmtTargetTableScan ( promotedTable , tableAlias , m_stmtId ) ; promotedScan . setOriginalSubqueryScan ( subqueryScan ) ; StmtTableScan prior = m_tableAliasMap . put ( tableAlias , promotedScan ) ; assert ( prior == subqueryScan ) ; m_tableList . add ( promotedTable ) ; return promotedScan ; }
Replace an existing subquery scan with its underlying table scan. The subquery
has already passed all the checks from the canSimplifySubquery method.
Subquery ORDER BY clause is ignored if such exists.

@param subqueryScan subquery scan to simplify
@param tableAlias
@return StmtTargetTableScan