private void addAllNestedExpressions(
     CubeQueryContext cubeql,
     ExprSpecContext baseEsc,
     AbstractBaseTable baseTable,
     Set<ExprSpecContext> nestedExpressions,
     Set<String> exprCols)
     throws SemanticException {
   for (String col : exprCols) {
     Set<ExprSpecContext> replacedExpressions = new LinkedHashSet<ExprSpecContext>();
     for (ExprSpec es : baseTable.getExpressionByName(col).getExpressionSpecs()) {
       ASTNode finalAST = HQLParser.copyAST(baseEsc.getFinalAST());
       replaceColumnInAST(finalAST, col, es.getASTNode());
       ExprSpecContext replacedESC = new ExprSpecContext(baseEsc, es, finalAST, cubeql);
       nestedExpressions.add(replacedESC);
       replacedExpressions.add(replacedESC);
     }
     Set<String> remaining = new LinkedHashSet<String>(exprCols);
     remaining.remove(col);
     for (ExprSpecContext replacedESC : replacedExpressions) {
       addAllNestedExpressions(cubeql, replacedESC, baseTable, nestedExpressions, remaining);
     }
   }
 }
 ExprSpecContext(ExprSpec exprSpec, CubeQueryContext cubeql) throws SemanticException {
   // replaces table names in expression with aliases in the query
   finalAST = replaceAlias(exprSpec.getASTNode(), cubeql);
   exprSpecs.add(exprSpec);
 }