Search in sources :

Example 1 with TimeDimensionProjection

use of com.yahoo.elide.datastores.aggregation.query.TimeDimensionProjection in project elide by yahoo.

the class EntityProjectionTranslatorTest method testTimeDimension.

@Test
public void testTimeDimension() {
    EntityProjection projection = basicProjection.copyOf().attribute(Attribute.builder().type(Date.class).name("recordedDate").build()).build();
    EntityProjectionTranslator translator = new EntityProjectionTranslator(engine, playerStatsTable, projection, scope, true);
    Query query = translator.getQuery();
    List<TimeDimensionProjection> timeDimensions = new ArrayList<>(query.getTimeDimensionProjections());
    assertEquals(1, timeDimensions.size());
    assertEquals("recordedDate", timeDimensions.get(0).getAlias());
    assertEquals(TimeGrain.DAY, timeDimensions.get(0).getGrain());
}
Also used : EntityProjection(com.yahoo.elide.core.request.EntityProjection) TimeDimensionProjection(com.yahoo.elide.datastores.aggregation.query.TimeDimensionProjection) Query(com.yahoo.elide.datastores.aggregation.query.Query) ArrayList(java.util.ArrayList) SQLUnitTest(com.yahoo.elide.datastores.aggregation.framework.SQLUnitTest) Test(org.junit.jupiter.api.Test)

Aggregations

EntityProjection (com.yahoo.elide.core.request.EntityProjection)1 SQLUnitTest (com.yahoo.elide.datastores.aggregation.framework.SQLUnitTest)1 Query (com.yahoo.elide.datastores.aggregation.query.Query)1 TimeDimensionProjection (com.yahoo.elide.datastores.aggregation.query.TimeDimensionProjection)1 ArrayList (java.util.ArrayList)1 Test (org.junit.jupiter.api.Test)1