use of io.trino.plugin.pinot.query.DynamicTable in project trino by trinodb.
the class TestPinotSplitManager method testSplitsBroker.
@Test
public void testSplitsBroker() {
SchemaTableName schemaTableName = new SchemaTableName("default", format("SELECT %s, %s FROM %s LIMIT %d", "AirlineID", "OriginStateName", "airlineStats", 100));
DynamicTable dynamicTable = buildFromPql(pinotMetadata, schemaTableName, mockClusterInfoFetcher);
PinotTableHandle pinotTableHandle = new PinotTableHandle("default", dynamicTable.getTableName(), TupleDomain.all(), OptionalLong.empty(), Optional.of(dynamicTable));
List<PinotSplit> splits = getSplitsHelper(pinotTableHandle, 1, false);
assertSplits(splits, 1, BROKER);
}
use of io.trino.plugin.pinot.query.DynamicTable in project trino by trinodb.
the class TestDynamicTable method testOfflineDynamicTable.
@Test
public void testOfflineDynamicTable() {
String tableName = hybridTable.getTableName();
String tableNameWithSuffix = tableName + OFFLINE_SUFFIX;
String query = format("select * from %s limit 70", tableNameWithSuffix);
DynamicTable dynamicTable = buildFromPql(pinotMetadata, new SchemaTableName("default", query), mockClusterInfoFetcher);
String expectedPql = format("select %s from %s limit 70", getColumnNames(tableName).stream().map(TestDynamicTable::quoteIdentifier).collect(joining(", ")), tableNameWithSuffix);
assertEquals(extractPql(dynamicTable, TupleDomain.all(), ImmutableList.of()), expectedPql);
assertEquals(dynamicTable.getTableName(), tableName);
}
use of io.trino.plugin.pinot.query.DynamicTable in project trino by trinodb.
the class TestDynamicTable method testGroupBy.
@Test
public void testGroupBy() {
String tableName = realtimeOnlyTable.getTableName();
long limit = 25;
String query = format("SELECT Origin, AirlineID, max(CarrierDelay), avg(CarrierDelay) FROM %s GROUP BY Origin, AirlineID LIMIT %s", tableName, limit);
DynamicTable dynamicTable = buildFromPql(pinotMetadata, new SchemaTableName("default", query), mockClusterInfoFetcher);
assertEquals(dynamicTable.getGroupingColumns().stream().map(PinotColumnHandle::getColumnName).collect(toImmutableList()), ImmutableList.builder().add("Origin").add("AirlineID").build());
assertEquals(dynamicTable.getLimit().getAsLong(), limit);
}
use of io.trino.plugin.pinot.query.DynamicTable in project trino by trinodb.
the class TestDynamicTable method testFilterWithCast.
@Test
public void testFilterWithCast() {
String tableName = "primitive_types_table";
String query = "SELECT string_col, long_col" + " FROM " + tableName + " WHERE string_col = CAST(123 AS STRING) AND long_col = CAST('123' AS LONG) LIMIT 60";
String expected = "select \"string_col\", \"long_col\" from primitive_types_table " + "where AND((\"string_col\") = (CAST('123' AS string)), (\"long_col\") = (CAST('123' AS long))) limit 60";
DynamicTable dynamicTable = buildFromPql(pinotMetadata, new SchemaTableName("default", query), mockClusterInfoFetcher);
assertEquals(extractPql(dynamicTable, TupleDomain.all(), ImmutableList.of()), expected);
}
use of io.trino.plugin.pinot.query.DynamicTable in project trino by trinodb.
the class TestDynamicTable method testFilterWithUdf.
@Test
public void testFilterWithUdf() {
String tableName = realtimeOnlyTable.getTableName();
String query = format("select FlightNum from %s where DivLongestGTimes = FLOOR(EXP(2 * LN(3))) AND 5 < EXP(CarrierDelay) limit 60", tableName.toLowerCase(ENGLISH));
DynamicTable dynamicTable = buildFromPql(pinotMetadata, new SchemaTableName("default", query), mockClusterInfoFetcher);
String expectedPql = "select \"FlightNum\" from realtimeonly where AND((\"DivLongestGTimes\") = '9.0', (exp(\"CarrierDelay\")) > '5') limit 60";
assertEquals(extractPql(dynamicTable, TupleDomain.all(), ImmutableList.of()), expectedPql);
}
Aggregations