Search in sources :

Example 6 with FilterConstraints

use of com.yahoo.elide.datastores.aggregation.filter.visitor.FilterConstraints in project elide by yahoo.

the class DefaultQueryValidatorTest method testHavingFilterPromotionUngroupedDimension.

@Test
public void testHavingFilterPromotionUngroupedDimension() throws ParseException {
    FilterExpression originalFilter = filterParser.parseFilterExpression("countryIsoCode==USA,lowScore<45", playerStatsType, false);
    SplitFilterExpressionVisitor visitor = new SplitFilterExpressionVisitor(playerStatsTable);
    FilterConstraints constraints = originalFilter.accept(visitor);
    FilterExpression whereFilter = constraints.getWhereExpression();
    FilterExpression havingFilter = constraints.getHavingExpression();
    Query query = Query.builder().source(playerStatsTable).metricProjection(playerStatsTable.getMetricProjection("lowScore")).whereFilter(whereFilter).havingFilter(havingFilter).build();
    validateQuery(query, "Invalid operation: Post aggregation filtering on 'countryIsoCode' requires the field to be projected in the response");
}
Also used : Query(com.yahoo.elide.datastores.aggregation.query.Query) SplitFilterExpressionVisitor(com.yahoo.elide.datastores.aggregation.filter.visitor.SplitFilterExpressionVisitor) FilterConstraints(com.yahoo.elide.datastores.aggregation.filter.visitor.FilterConstraints) FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) SQLUnitTest(com.yahoo.elide.datastores.aggregation.framework.SQLUnitTest) Test(org.junit.jupiter.api.Test)

Aggregations

FilterExpression (com.yahoo.elide.core.filter.expression.FilterExpression)6 FilterConstraints (com.yahoo.elide.datastores.aggregation.filter.visitor.FilterConstraints)6 SplitFilterExpressionVisitor (com.yahoo.elide.datastores.aggregation.filter.visitor.SplitFilterExpressionVisitor)6 SQLUnitTest (com.yahoo.elide.datastores.aggregation.framework.SQLUnitTest)5 Query (com.yahoo.elide.datastores.aggregation.query.Query)5 Test (org.junit.jupiter.api.Test)5 EntityProjection (com.yahoo.elide.core.request.EntityProjection)1