use of example.PlayerStatsWithRequiredFilter in project elide by yahoo.
the class AggregationDataStoreTransactionTest method testMissingRequiredColumnFilter.
@Test
public void testMissingRequiredColumnFilter() throws Exception {
Type<PlayerStatsWithRequiredFilter> tableType = ClassType.of(PlayerStatsWithRequiredFilter.class);
EntityDictionary dictionary = EntityDictionary.builder().build();
dictionary.bindEntity(PlayerStatsWithRequiredFilter.class);
SQLTable table = new SQLTable(new Namespace(DEFAULT_NAMESPACE), tableType, dictionary);
Query query = Query.builder().column(SQLMetricProjection.builder().name("highScore").build()).source(table).build();
AggregationDataStoreTransaction tx = new AggregationDataStoreTransaction(queryEngine, cache, queryLogger);
assertThrows(BadRequestException.class, () -> tx.addColumnFilterArguments(table, query, dictionary));
}
use of example.PlayerStatsWithRequiredFilter in project elide by yahoo.
the class AggregationDataStoreTransactionTest method testRequiredColumnFilterArguments.
@Test
public void testRequiredColumnFilterArguments() throws Exception {
Type<PlayerStatsWithRequiredFilter> tableType = ClassType.of(PlayerStatsWithRequiredFilter.class);
EntityDictionary dictionary = EntityDictionary.builder().build();
dictionary.bindEntity(PlayerStatsWithRequiredFilter.class);
SQLTable table = new SQLTable(new Namespace(DEFAULT_NAMESPACE), tableType, dictionary);
RSQLFilterDialect filterDialect = RSQLFilterDialect.builder().dictionary(dictionary).build();
FilterExpression where = filterDialect.parse(tableType, new HashSet<>(), "recordedDate>2019-07-12T00:00Z", NO_VERSION);
Query query = Query.builder().column(SQLMetricProjection.builder().name("highScore").alias("highScore").build()).whereFilter(where).source(table).build();
AggregationDataStoreTransaction tx = new AggregationDataStoreTransaction(queryEngine, cache, queryLogger);
Query modifiedQuery = tx.addColumnFilterArguments(table, query, dictionary);
Map<String, Argument> columnArguments = modifiedQuery.getColumnProjection("highScore").getArguments();
assertTrue(columnArguments.containsKey("recordedDate"));
assertEquals(1, columnArguments.size());
}
use of example.PlayerStatsWithRequiredFilter in project elide by yahoo.
the class AggregationDataStoreTransactionTest method testRequiredTableFilterArguments.
@Test
public void testRequiredTableFilterArguments() throws Exception {
Type<PlayerStatsWithRequiredFilter> tableType = ClassType.of(PlayerStatsWithRequiredFilter.class);
EntityDictionary dictionary = EntityDictionary.builder().build();
dictionary.bindEntity(PlayerStatsWithRequiredFilter.class);
SQLTable table = new SQLTable(new Namespace(DEFAULT_NAMESPACE), tableType, dictionary);
RSQLFilterDialect filterDialect = RSQLFilterDialect.builder().dictionary(dictionary).build();
FilterExpression where = filterDialect.parse(tableType, new HashSet<>(), "recordedDate>=2019-07-12T00:00Z;recordedDate<2030-07-12T00:00Z", NO_VERSION);
Query query = Query.builder().source(table).whereFilter(where).build();
AggregationDataStoreTransaction tx = new AggregationDataStoreTransaction(queryEngine, cache, queryLogger);
Query modifiedQuery = tx.addTableFilterArguments(table, query, dictionary);
Map<String, Argument> tableArguments = modifiedQuery.getArguments();
assertTrue(tableArguments.containsKey("start"));
assertTrue(tableArguments.containsKey("end"));
assertEquals(2, tableArguments.size());
}
Aggregations