public String visit()

in asterix-graphix/src/main/java/org/apache/asterix/graphix/lang/rewrite/print/SqlppASTPrintQueryVisitor.java [155:198]


    public String visit(SelectBlock selectBlock, Void arg) throws CompilationException {
        StringBuilder sb = new StringBuilder();
        sb.append(visitAndSwallowException(selectBlock.getSelectClause()));
        if (selectBlock.hasFromClause()) {
            sb.append(selectBlock.getFromClause().accept(this, arg));
        }
        if (selectBlock.hasLetWhereClauses()) {
            List<LetClause> letClauses = selectBlock.getLetWhereList().stream()
                    .filter(c -> c.getClauseType() == Clause.ClauseType.LET_CLAUSE).map(c -> (LetClause) c)
                    .collect(Collectors.toList());
            List<WhereClause> whereClauses = selectBlock.getLetWhereList().stream()
                    .filter(c -> c.getClauseType() == Clause.ClauseType.WHERE_CLAUSE).map(c -> (WhereClause) c)
                    .collect(Collectors.toList());
            if (!letClauses.isEmpty()) {
                sb.append(" LET ");
                sb.append(letClauses.stream().map(this::visitAndSwallowException).collect(Collectors.joining(", ")));
            }
            if (!whereClauses.isEmpty()) {
                sb.append(" WHERE ");
                sb.append(
                        whereClauses.stream().map(this::visitAndSwallowException).collect(Collectors.joining(" AND ")));
            }
        }
        if (selectBlock.hasGroupbyClause()) {
            sb.append(selectBlock.getGroupbyClause().accept(this, arg));
        }
        if (selectBlock.hasLetHavingClausesAfterGroupby()) {
            List<LetClause> letClauses = selectBlock.getLetHavingListAfterGroupby().stream()
                    .filter(c -> c.getClauseType() == Clause.ClauseType.LET_CLAUSE).map(c -> (LetClause) c)
                    .collect(Collectors.toList());
            List<HavingClause> havingClauses = selectBlock.getLetHavingListAfterGroupby().stream()
                    .filter(c -> c.getClauseType() == Clause.ClauseType.HAVING_CLAUSE).map(c -> (HavingClause) c)
                    .collect(Collectors.toList());
            if (!letClauses.isEmpty()) {
                sb.append(" LET ");
                sb.append(letClauses.stream().map(this::visitAndSwallowException).collect(Collectors.joining(", ")));
            }
            if (!havingClauses.isEmpty()) {
                sb.append(" HAVING ");
                sb.append(havingClauses.stream().map(this::visitAndSwallowException).collect(Collectors.joining(", ")));
            }
        }
        return sb.toString();
    }