use of io.trino.plugin.pinot.query.DynamicTable in project trino by trinodb.
the class TestDynamicTable method testSelectExpressionsWithAliases.
@Test
public void testSelectExpressionsWithAliases() {
String tableName = hybridTable.getTableName();
String tableNameWithSuffix = tableName + REALTIME_SUFFIX;
String query = format("select datetimeconvert(dayssinceEpoch, '1:seconds:epoch', '1:milliseconds:epoch', '15:minutes'), " + "case origincityname when 'nyc' then 'pizza' when 'la' then 'burrito' when 'boston' then 'clam chowder'" + " else 'burger' end != 'salad'," + " timeconvert(dayssinceEpoch, 'seconds', 'minutes') as foo" + " from %s limit 70", tableNameWithSuffix);
DynamicTable dynamicTable = buildFromPql(pinotMetadata, new SchemaTableName("default", query), mockClusterInfoFetcher);
String expectedPql = format("select datetimeconvert(\"DaysSinceEpoch\", '1:SECONDS:EPOCH', '1:MILLISECONDS:EPOCH', '15:MINUTES')," + " not_equals(CASE WHEN equals(\"OriginCityName\", 'nyc') THEN 'pizza' WHEN equals(\"OriginCityName\", 'la') THEN 'burrito' WHEN equals(\"OriginCityName\", 'boston') THEN 'clam chowder' ELSE 'burger' END, 'salad')," + " timeconvert(\"DaysSinceEpoch\", 'SECONDS', 'MINUTES') AS \"foo\" from %s limit 70", 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 testQuotesInColumnName.
@Test
public void testQuotesInColumnName() {
String tableName = "quotes_in_column_names";
String tableNameWithSuffix = tableName + REALTIME_SUFFIX;
String query = format("select \"qu\"\"ot\"\"ed\" from %s limit 50", tableNameWithSuffix);
DynamicTable dynamicTable = buildFromPql(pinotMetadata, new SchemaTableName("default", query), mockClusterInfoFetcher);
String expectedPql = format("select \"qu\"\"ot\"\"ed\" from %s limit 50", 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 testJsonMatch.
@Test
public void testJsonMatch() {
String tableName = hybridTable.getTableName();
String tableNameWithSuffix = tableName + REALTIME_SUFFIX;
String query = format("select origincityname from %s where json_match(origincityname, '\"$.name\"=''new york''') limit 70", tableNameWithSuffix);
DynamicTable dynamicTable = buildFromPql(pinotMetadata, new SchemaTableName("default", query), mockClusterInfoFetcher);
String expectedPql = format("select \"OriginCityName\" from %s where json_match(\"OriginCityName\", '\"$.name\"=''new york''') limit 70", tableNameWithSuffix);
assertEquals(extractPql(dynamicTable, TupleDomain.all(), ImmutableList.of()), expectedPql);
assertEquals(dynamicTable.getTableName(), tableName);
}
Aggregations