use of io.trino.sql.planner.OrderingScheme in project trino by trinodb.
the class TestPushdownFilterIntoWindow method assertNoUpperBound.
private void assertNoUpperBound(String rankingFunctionName) {
ResolvedFunction ranking = tester().getMetadata().resolveFunction(tester().getSession(), QualifiedName.of(rankingFunctionName), fromTypes());
tester().assertThat(new PushdownFilterIntoWindow(tester().getPlannerContext())).on(p -> {
Symbol rowNumberSymbol = p.symbol("row_number_1");
Symbol a = p.symbol("a");
OrderingScheme orderingScheme = new OrderingScheme(ImmutableList.of(a), ImmutableMap.of(a, SortOrder.ASC_NULLS_FIRST));
return p.filter(expression("cast(3 as bigint) < row_number_1"), p.window(new WindowNode.Specification(ImmutableList.of(a), Optional.of(orderingScheme)), ImmutableMap.of(rowNumberSymbol, newWindowNodeFunction(ranking, a)), p.values(a)));
}).doesNotFire();
}
use of io.trino.sql.planner.OrderingScheme in project trino by trinodb.
the class TestPushdownFilterIntoWindow method assertEliminateFilter.
private void assertEliminateFilter(String rankingFunctionName) {
ResolvedFunction ranking = tester().getMetadata().resolveFunction(tester().getSession(), QualifiedName.of(rankingFunctionName), fromTypes());
tester().assertThat(new PushdownFilterIntoWindow(tester().getPlannerContext())).on(p -> {
Symbol rankSymbol = p.symbol("rank_1");
Symbol a = p.symbol("a", BIGINT);
OrderingScheme orderingScheme = new OrderingScheme(ImmutableList.of(a), ImmutableMap.of(a, SortOrder.ASC_NULLS_FIRST));
return p.filter(expression("rank_1 < cast(100 as bigint)"), p.window(new WindowNode.Specification(ImmutableList.of(a), Optional.of(orderingScheme)), ImmutableMap.of(rankSymbol, newWindowNodeFunction(ranking, a)), p.values(p.symbol("a"))));
}).matches(topNRanking(pattern -> pattern.maxRankingPerPartition(99).partial(false), values("a")));
}
use of io.trino.sql.planner.OrderingScheme in project trino by trinodb.
the class TestPushdownLimitIntoWindow method assertZeroLimit.
private void assertZeroLimit(String rankingFunctionName) {
ResolvedFunction ranking = tester().getMetadata().resolveFunction(tester().getSession(), QualifiedName.of(rankingFunctionName), fromTypes());
tester().assertThat(new PushdownLimitIntoWindow()).on(p -> {
Symbol a = p.symbol("a");
Symbol rowNumberSymbol = p.symbol("row_number_1");
OrderingScheme orderingScheme = new OrderingScheme(ImmutableList.of(a), ImmutableMap.of(a, SortOrder.ASC_NULLS_FIRST));
return p.limit(0, p.window(new WindowNode.Specification(ImmutableList.of(a), Optional.of(orderingScheme)), ImmutableMap.of(rowNumberSymbol, newWindowNodeFunction(ranking, a)), p.values(a)));
}).doesNotFire();
}
Aggregations