fe/src/main/java/com/cloudera/impala/analysis/QueryStmt.java
/**
   * Creates sortInfo by resolving aliases and ordinals in the orderingExprs.
   */
Creates sortInfo by resolving aliases and ordinals in the orderingExprs.
Creates sortInfo by resolving aliases and ordinals in the orderingExprs .
protected void createSortInfo(Analyzer analyzer) throws AnalysisException,
      AuthorizationException {
    if (orderByElements_ == null) return;
    ArrayList<Expr> orderingExprs = Lists.newArrayList();
    ArrayList<Boolean> isAscOrder = Lists.newArrayList();
    ArrayList<Boolean> nullsFirstParams = Lists.newArrayList();
    for (OrderByElement orderByElement: orderByElements_) {
      orderingExprs.add(orderByElement.getExpr().clone(null));
      isAscOrder.add(Boolean.valueOf(orderByElement.getIsAsc()));
      nullsFirstParams.add(orderByElement.getNullsFirstParam());
    }
    substituteOrdinals(orderingExprs, "ORDER BY");
    Expr ambiguousAlias = getFirstAmbiguousAlias(orderingExprs);
    if (ambiguousAlias != null) {
      throw new AnalysisException("Column " + ambiguousAlias.toSql() +
          " in order clause is ambiguous");
    }
    Expr.substituteList(orderingExprs, aliasSmap_);
    Expr.analyze(orderingExprs, analyzer);
    sortInfo_ = new SortInfo(orderingExprs, isAscOrder, nullsFirstParams);
  }
protected void createSortInfo ( Analyzer analyzer ) throws AnalysisException , AuthorizationException { if ( orderByElements_ == null ) return ; ArrayList < Expr > orderingExprs = Lists . newArrayList ( ) ; ArrayList < Boolean > isAscOrder = Lists . newArrayList ( ) ; ArrayList < Boolean > nullsFirstParams = Lists . newArrayList ( ) ; for ( OrderByElement orderByElement : orderByElements_ ) { orderingExprs . add ( orderByElement . getExpr ( ) . clone ( null ) ) ; isAscOrder . add ( Boolean . valueOf ( orderByElement . getIsAsc ( ) ) ) ; nullsFirstParams . add ( orderByElement . getNullsFirstParam ( ) ) ; } substituteOrdinals ( orderingExprs , "ORDER BY" ) ; Expr ambiguousAlias = getFirstAmbiguousAlias ( orderingExprs ) ; if ( ambiguousAlias != null ) { throw new AnalysisException ( "Column " + ambiguousAlias . toSql ( ) + " in order clause is ambiguous" ) ; } Expr . substituteList ( orderingExprs , aliasSmap_ ) ; Expr . analyze ( orderingExprs , analyzer ) ; sortInfo_ = new SortInfo ( orderingExprs , isAscOrder , nullsFirstParams ) ; }
Creates sortInfo by resolving aliases and ordinals in the orderingExprs.
Creates sortInfo by resolving aliases and ordinals in the orderingExprs .
// not computing order by // extract exprs // create copies, we don't want to modify the original parse node, in case // we need to print it