use of io.trino.plugin.pinot.query.OrderByExpression in project trino by trinodb.
the class TestDynamicTable method testSelectNoFilter.
@Test
public void testSelectNoFilter() {
String tableName = realtimeOnlyTable.getTableName();
List<String> columnNames = getColumnNames(tableName);
List<String> orderByColumns = columnNames.subList(0, 5);
List<OrderByExpression> orderByExpressions = orderByColumns.stream().limit(4).map(columnName -> new OrderByExpression(quoteIdentifier(columnName), true)).collect(toList());
long limit = 230;
String query = format("select %s from %s order by %s limit %s", join(", ", columnNames), tableName, orderByColumns.stream().collect(joining(", ")) + " desc", limit);
DynamicTable dynamicTable = buildFromPql(pinotMetadata, new SchemaTableName("default", query), mockClusterInfoFetcher);
assertEquals(dynamicTable.getProjections().stream().map(PinotColumnHandle::getColumnName).collect(toImmutableList()), columnNames);
orderByExpressions.add(new OrderByExpression(quoteIdentifier(orderByColumns.get(4)), false));
assertEquals(dynamicTable.getOrderBy(), orderByExpressions);
assertEquals(dynamicTable.getLimit().getAsLong(), limit);
}
Aggregations