use of com.yahoo.elide.datastores.aggregation.query.Query in project elide by yahoo.
the class PrestoDBExplainQueryTest method testLeftJoin.
@Test
public void testLeftJoin() throws Exception {
Query query = TestQuery.LEFT_JOIN.getQuery();
String expectedQueryStr = "SELECT DISTINCT \"example_VideoGame_player_XXX\".\"name\" AS \"playerName\" FROM \"videoGames\" AS \"example_VideoGame\"" + " LEFT OUTER JOIN \"players\" AS \"example_VideoGame_player_XXX\" ON \"example_VideoGame\".\"player_id\"" + " = \"example_VideoGame_player_XXX\".\"id\"";
compareQueryLists(expectedQueryStr, engine.explain(query));
}
use of com.yahoo.elide.datastores.aggregation.query.Query in project elide by yahoo.
the class PrestoDBExplainQueryTest method testPaginationMetricsOnly.
@Test
public void testPaginationMetricsOnly() throws Exception {
// pagination query should be empty since there is no dimension projection
Query query = TestQuery.PAGINATION_METRIC_ONLY.getQuery();
String expectedQueryStr = "SELECT MIN(\"example_PlayerStats\".\"lowScore\") AS \"lowScore\" " + "FROM \"playerStats\" AS \"example_PlayerStats\" " + "LIMIT 5\n";
compareQueryLists(expectedQueryStr, engine.explain(query));
testQueryExecution(TestQuery.PAGINATION_METRIC_ONLY.getQuery());
}
use of com.yahoo.elide.datastores.aggregation.query.Query in project elide by yahoo.
the class PrestoDBExplainQueryTest method testNestedMetricWithWhereQuery.
@Test
public void testNestedMetricWithWhereQuery() {
Query query = TestQuery.NESTED_METRIC_WITH_WHERE_QUERY.getQuery();
String exptectedQueryStr = getExpectedNestedMetricWithWhereQuery().replace(BACKTICK, DOUBLE_QUOTE);
List<String> expectedQueryList = new ArrayList<>();
expectedQueryList.add(exptectedQueryStr);
compareQueryLists(expectedQueryList, engine.explain(query));
}
use of com.yahoo.elide.datastores.aggregation.query.Query in project elide by yahoo.
the class PrestoDBExplainQueryTest method testNestedMetricWithAliasesQuery.
@Test
public void testNestedMetricWithAliasesQuery() {
Query query = TestQuery.NESTED_METRIC_WITH_ALIASES_QUERY.getQuery();
String queryStr = engine.explain(query).get(0);
queryStr = repeatedWhitespacePattern.matcher(queryStr).replaceAll(" ");
queryStr = queryStr.replaceAll(":[a-zA-Z0-9_]+", ":XXX");
queryStr = queryStr.replaceAll("PlayerStats_\\d+", "PlayerStats_XXX");
queryStr = queryStr.replaceAll("PlayerStats_country_\\d+", "PlayerStats_country_XXX");
String expectedStr = getExpectedNestedMetricWithAliasesSQL(true).replace(BACKTICK, DOUBLE_QUOTE);
assertEquals(expectedStr, queryStr);
}
use of com.yahoo.elide.datastores.aggregation.query.Query in project elide by yahoo.
the class PrestoDBExplainQueryTest method testNestedMetricQuery.
@Test
public void testNestedMetricQuery() {
Query query = TestQuery.NESTED_METRIC_QUERY.getQuery();
String exptectedQueryStr = getExpectedNestedMetricQuery().replace(BACKTICK, DOUBLE_QUOTE);
List<String> expectedQueryList = new ArrayList<>();
expectedQueryList.add(exptectedQueryStr);
compareQueryLists(expectedQueryList, engine.explain(query));
testQueryExecution(TestQuery.NESTED_METRIC_QUERY.getQuery());
}
Aggregations