コード例 #1
0
ファイル: SelectStmt.java プロジェクト: nealsid/Impala
 /** Populates baseTblSmap_ with our combined inline view smap and creates baseTblResultExprs. */
 protected void resolveInlineViewRefs(Analyzer analyzer) {
   // Gather the inline view substitution maps from the enclosed inline views
   for (TableRef tblRef : tableRefs_) {
     if (tblRef instanceof InlineViewRef) {
       InlineViewRef inlineViewRef = (InlineViewRef) tblRef;
       baseTblSmap_ = Expr.SubstitutionMap.combine(baseTblSmap_, inlineViewRef.getBaseTblSmap());
     }
   }
   baseTblResultExprs_ = Expr.cloneList(resultExprs_, baseTblSmap_);
   LOG.trace("baseTblSmap_: " + baseTblSmap_.debugString());
   LOG.trace("resultExprs: " + Expr.debugString(resultExprs_));
   LOG.trace("baseTblResultExprs: " + Expr.debugString(baseTblResultExprs_));
 }
コード例 #2
0
ファイル: SelectStmt.java プロジェクト: vthacker/impala-port
  /**
   * 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);
  }