/** * This select block might contain inline views. Substitute all exprs (result of the analysis) of * this select block referencing any of our inlined views, including everything registered with * the analyzer. Expressions created during parsing (such as whereClause) are not touched. */ protected void substituteInlineViewExprs(Analyzer analyzer) { // Gather the inline view substitution maps from the enclosed inline views Expr.SubstitutionMap sMap = new Expr.SubstitutionMap(); for (TableRef tblRef : tableRefs) { if (tblRef instanceof InlineViewRef) { InlineViewRef inlineViewRef = (InlineViewRef) tblRef; sMap = Expr.SubstitutionMap.combine(sMap, inlineViewRef.getExprSMap()); } } // we might not have anything to substitute if (sMap.lhs.size() == 0) { return; } // Substitute select list, join clause, where clause, aggregate, order by // and this select block's analyzer expressions // select Expr.substituteList(resultExprs, sMap); // aggregation (group by and aggregation expr) if (aggInfo != null) { aggInfo.substitute(sMap); } // having if (havingPred != null) { havingPred.substitute(sMap); } // ordering if (sortInfo != null) { sortInfo.substitute(sMap); } // expressions registered inside the analyzer analyzer.substitute(sMap); }