@Override public Void visit(SelectExpression selectStatement, Void arg) throws CompilationException { selectStatement.getSelectSetOperation().accept(this, arg); if (selectStatement.hasOrderby()) { selectStatement.getOrderbyClause().accept(this, arg); } if (selectStatement.hasLimit()) { selectStatement.getLimitClause().accept(this, arg); } return null; }
selectExpression.getOrderbyClause().accept(visitor, arg);
@Override public SelectExpression visit(SelectExpression selectExpression, Void arg) throws CompilationException { List<LetClause> lets = new ArrayList<>(); SelectSetOperation select; OrderbyClause orderby = null; LimitClause limit = null; // visit let list if (selectExpression.hasLetClauses()) { for (LetClause letClause : selectExpression.getLetList()) { lets.add((LetClause) letClause.accept(this, arg)); } } // visit the main select. select = (SelectSetOperation) selectExpression.getSelectSetOperation().accept(this, arg); // visit order by if (selectExpression.hasOrderby()) { orderby = (OrderbyClause) selectExpression.getOrderbyClause().accept(this, arg); } // visit limit if (selectExpression.hasLimit()) { limit = (LimitClause) selectExpression.getLimitClause().accept(this, arg); } SelectExpression copy = new SelectExpression(lets, select, orderby, limit, selectExpression.isSubquery()); copy.addHints(selectExpression.getHints()); return copy; }
@Override public Void visit(SelectExpression selectStatement, Integer step) throws CompilationException { if (selectStatement.isSubquery()) { out.print("("); } int selectStep = selectStatement.isSubquery() ? step + 2 : step; if (selectStatement.hasLetClauses()) { for (LetClause letClause : selectStatement.getLetList()) { letClause.accept(this, selectStep); } } selectStatement.getSelectSetOperation().accept(this, selectStep); if (selectStatement.hasOrderby()) { selectStatement.getOrderbyClause().accept(this, selectStep); } if (selectStatement.hasLimit()) { selectStatement.getLimitClause().accept(this, selectStep); } if (selectStatement.isSubquery()) { out.print(skip(step) + " )"); } return null; }
@Override public Void visit(SelectExpression selectStatement, Integer step) throws CompilationException { if (selectStatement.isSubquery()) { out.println(skip(step) + "("); } int selectStep = selectStatement.isSubquery() ? step + 1 : step; if (selectStatement.hasLetClauses()) { for (LetClause letClause : selectStatement.getLetList()) { letClause.accept(this, selectStep); } } selectStatement.getSelectSetOperation().accept(this, selectStep); if (selectStatement.hasOrderby()) { selectStatement.getOrderbyClause().accept(this, selectStep); } if (selectStatement.hasLimit()) { selectStatement.getLimitClause().accept(this, selectStep); } if (selectStatement.isSubquery()) { out.println(skip(step) + ")"); } return null; }
orderbyClause.accept(this, arg); rewriteExpressionUsingGroupVariable(groupVar, groupFieldVars, orderbyClause, visibleVarsPreGroupByScope);
@Override public Boolean visit(SelectExpression selectExpression, List<FunctionDecl> funcs) throws CompilationException { boolean changed = false; if (selectExpression.hasLetClauses()) { for (LetClause letClause : selectExpression.getLetList()) { changed |= letClause.accept(this, funcs); } } changed |= selectExpression.getSelectSetOperation().accept(this, funcs); if (selectExpression.hasOrderby()) { changed |= selectExpression.getOrderbyClause().accept(this, funcs); } if (selectExpression.hasLimit()) { changed |= selectExpression.getLimitClause().accept(this, funcs); } return changed; }
p = selectExpression.getOrderbyClause().accept(this, currentEnv); newOrderbyClause = (OrderbyClause) p.first; currentEnv = p.second;
@Override public Expression visit(SelectExpression selectExpression, ILangExpression arg) throws CompilationException { // visit let list if (selectExpression.hasLetClauses()) { for (LetClause letClause : selectExpression.getLetList()) { letClause.accept(this, selectExpression); } } // visit the main select. selectExpression.getSelectSetOperation().accept(this, selectExpression); // visit order by if (selectExpression.hasOrderby()) { selectExpression.getOrderbyClause().accept(this, selectExpression); } // visit limit if (selectExpression.hasLimit()) { selectExpression.getLimitClause().accept(this, selectExpression); } return selectExpression; }
selectExpression.getOrderbyClause().accept(visitor, arg);
@Override public Expression visit(SelectExpression selectExpression, ILangExpression arg) throws CompilationException { Scope scopeBeforeSelectExpression = scopeChecker.getCurrentScope(); scopeChecker.createNewScope(); // visit let list if (selectExpression.hasLetClauses()) { for (LetClause letClause : selectExpression.getLetList()) { letClause.accept(this, selectExpression); } scopeChecker.createNewScope(); } // visit the main select. selectExpression.getSelectSetOperation().accept(this, selectExpression); // visit order by if (selectExpression.hasOrderby()) { selectExpression.getOrderbyClause().accept(this, selectExpression); } // visit limit if (selectExpression.hasLimit()) { selectExpression.getLimitClause().accept(this, selectExpression); } // Exit scopes that were entered within this select expression while (scopeChecker.getCurrentScope() != scopeBeforeSelectExpression) { scopeChecker.removeCurrentScope(); } return selectExpression; }
@Override public Pair<ILogicalOperator, LogicalVariable> visit(SelectExpression selectExpression, Mutable<ILogicalOperator> tupSource) throws CompilationException { if (selectExpression.isSubquery()) { context.enterSubplan(); } Mutable<ILogicalOperator> currentOpRef = tupSource; if (selectExpression.hasLetClauses()) { for (LetClause letClause : selectExpression.getLetList()) { currentOpRef = new MutableObject<>(letClause.accept(this, currentOpRef).first); } } Pair<ILogicalOperator, LogicalVariable> select = selectExpression.getSelectSetOperation().accept(this, currentOpRef); currentOpRef = new MutableObject<>(select.first); if (selectExpression.hasOrderby()) { currentOpRef = new MutableObject<>(selectExpression.getOrderbyClause().accept(this, currentOpRef).first); } if (selectExpression.hasLimit()) { currentOpRef = new MutableObject<>(selectExpression.getLimitClause().accept(this, currentOpRef).first); } Pair<ILogicalOperator, LogicalVariable> result = produceSelectPlan(selectExpression.isSubquery(), currentOpRef, select.second); if (selectExpression.isSubquery()) { context.exitSubplan(); } return result; }