@Override protected R visitGroupBy(final GroupBy node, final C context) { for (final GroupingElement groupingElement : node.getGroupingElements()) { process(groupingElement, context); } return null; }
@Override protected R visitGroupBy(final GroupBy node, final C context) { for (final GroupingElement groupingElement : node.getGroupingElements()) { process(groupingElement, context); } return null; }
@Override protected Node visitGroupBy(final GroupBy node, final Node parent) { node.setParent(parent); for (final GroupingElement groupingElement : node.getGroupingElements()) { process(groupingElement, node); } return null; }
protected Node visitGroupBy(final GroupBy node, final Object context) { // use an if/else block here (instead of isPresent.map(...).orElse(...)) so only one object // gets instantiated (issue #1784) if (node.getLocation().isPresent()) { return new GroupBy( node.getLocation().get(), node.isDistinct(), node.getGroupingElements().stream() .map(groupingElement -> (GroupingElement) process(groupingElement, context)) .collect(Collectors.toList())); } else { return new GroupBy( node.isDistinct(), node.getGroupingElements().stream() .map(groupingElement -> (GroupingElement) process(groupingElement, context)) .collect(Collectors.toList()) ); } }
@Override protected Void visitQuerySpecification(final QuerySpecification node, final Integer indent) { process(node.getSelect(), indent); append(indent, "FROM "); processRelation(node.getFrom(), indent); builder.append('\n'); append(indent, " "); builder.append('\n'); if (node.getWhere().isPresent()) { append(indent, "WHERE " + ExpressionFormatter.formatExpression(node.getWhere().get())) .append('\n'); } if (node.getGroupBy().isPresent()) { append(indent, "GROUP BY " + (node.getGroupBy().get().isDistinct() ? " DISTINCT " : "") + ExpressionFormatter .formatGroupBy(node.getGroupBy().get().getGroupingElements())) .append('\n'); } if (node.getHaving().isPresent()) { append(indent, "HAVING " + ExpressionFormatter.formatExpression(node.getHaving().get())) .append('\n'); } if (node.getLimit().isPresent()) { append(indent, "LIMIT " + node.getLimit().get()) .append('\n'); } return null; }