use of org.apache.asterix.lang.common.expression.GbyVariableExpressionPair in project asterixdb by apache.
the class SqlppGlobalAggregationSugarVisitor method visit.
@Override
public Expression visit(SelectBlock selectBlock, ILangExpression arg) throws CompilationException {
SelectClause selectClause = selectBlock.getSelectClause();
if (!selectBlock.hasGroupbyClause() && selectBlock.hasFromClause()) {
boolean addImplicitGby;
if (selectClause.selectRegular()) {
addImplicitGby = isSql92Aggregate(selectClause.getSelectRegular(), selectBlock);
} else {
addImplicitGby = isSql92Aggregate(selectClause.getSelectElement(), selectBlock);
}
if (addImplicitGby) {
// Adds an implicit group-by clause for SQL-92 global aggregate.
List<GbyVariableExpressionPair> gbyPairList = new ArrayList<>();
List<GbyVariableExpressionPair> decorPairList = new ArrayList<>();
GroupbyClause gbyClause = new GroupbyClause(gbyPairList, decorPairList, new HashMap<>(), null, null, false, true);
selectBlock.setGroupbyClause(gbyClause);
}
}
return super.visit(selectBlock, arg);
}
Aggregations