use of org.apache.flink.table.operations.utils.OperationExpressionsUtils.CategorizedExpressions in project flink by apache.
the class TableImpl method select.
@Override
public Table select(Expression... fields) {
List<Expression> expressionsWithResolvedCalls = preprocessExpressions(fields);
CategorizedExpressions extracted = OperationExpressionsUtils.extractAggregationsAndProperties(expressionsWithResolvedCalls);
if (!extracted.getWindowProperties().isEmpty()) {
throw new ValidationException("Window properties can only be used on windowed tables.");
}
if (!extracted.getAggregations().isEmpty()) {
QueryOperation aggregate = operationTreeBuilder.aggregate(Collections.emptyList(), extracted.getAggregations(), operationTree);
return createTable(operationTreeBuilder.project(extracted.getProjections(), aggregate, false));
} else {
return createTable(operationTreeBuilder.project(expressionsWithResolvedCalls, operationTree, false));
}
}
use of org.apache.flink.table.operations.utils.OperationExpressionsUtils.CategorizedExpressions in project flink by apache.
the class TableImpl method addColumnsOperation.
private Table addColumnsOperation(boolean replaceIfExist, List<Expression> fields) {
List<Expression> expressionsWithResolvedCalls = preprocessExpressions(fields);
CategorizedExpressions extracted = OperationExpressionsUtils.extractAggregationsAndProperties(expressionsWithResolvedCalls);
List<Expression> aggNames = extracted.getAggregations();
if (!aggNames.isEmpty()) {
throw new ValidationException("The added field expression cannot be an aggregation, found: " + aggNames.get(0));
}
return createTable(operationTreeBuilder.addColumns(replaceIfExist, expressionsWithResolvedCalls, operationTree));
}
Aggregations