use of com.facebook.presto.sql.tree.SortItem.NullOrdering.LAST in project presto by prestodb.
the class TestLogicalPlanner method testOffset.
@Test
public void testOffset() {
Session enableOffset = Session.builder(this.getQueryRunner().getDefaultSession()).setSystemProperty(OFFSET_CLAUSE_ENABLED, "true").build();
assertPlanWithSession("SELECT name FROM nation OFFSET 2 ROWS", enableOffset, true, any(strictProject(ImmutableMap.of("name", new ExpressionMatcher("name")), filter("(row_num > BIGINT '2')", rowNumber(pattern -> pattern.partitionBy(ImmutableList.of()), any(tableScan("nation", ImmutableMap.of("NAME", "name")))).withAlias("row_num", new RowNumberSymbolMatcher())))));
assertPlanWithSession("SELECT name FROM nation ORDER BY regionkey OFFSET 2 ROWS", enableOffset, true, any(strictProject(ImmutableMap.of("name", new ExpressionMatcher("name")), filter("row_num > BIGINT '2'", rowNumber(pattern -> pattern.partitionBy(ImmutableList.of()), anyTree(sort(ImmutableList.of(sort("regionkey", ASCENDING, LAST)), any(tableScan("nation", ImmutableMap.of("name", "name", "regionkey", "regionkey")))))).withAlias("row_num", new RowNumberSymbolMatcher())))));
}
Aggregations