This commit is contained in:
Zoltan Haindrich 2023-08-25 10:01:09 +00:00
parent b37d8ef412
commit bd7a49bd49
1 changed files with 19 additions and 19 deletions

View File

@ -34,7 +34,6 @@ import org.apache.druid.query.LookupDataSource;
import org.apache.druid.query.QueryDataSource;
import org.apache.druid.query.aggregation.CountAggregatorFactory;
import org.apache.druid.query.aggregation.DoubleSumAggregatorFactory;
import org.apache.druid.query.aggregation.last.StringLastAggregatorFactory;
import org.apache.druid.query.dimension.DefaultDimensionSpec;
import org.apache.druid.query.extraction.SubstringDimExtractionFn;
import org.apache.druid.query.groupby.GroupByQuery;
@ -1942,28 +1941,29 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
.sql("SELECT\n"
+ " channel\n"
+ " ,cityName\n"
// + " ,LATEST_BY(\"cityName\", __time, 128) as latest_by_time_page\n"
+ " ,LATEST_BY(\"cityName\", TIMESTAMPADD(HOUR, 1, \"__time\"), 128) as latest_by_time_page\n"
+ "FROM druid.wikipedia\n"
+ "where channel < '#b' and cityName < 'D'\n"
+ "where channel < '#b' and cityName < 'B'\n"
+ "GROUP BY 1,2"
)
.expectedQueries(
ImmutableList.of(
GroupByQuery.builder()
.setDataSource("wikipedia")
.setInterval(querySegmentSpec(Filtration.eternity()))
.setGranularity(Granularities.ALL)
.setVirtualColumns(
expressionVirtualColumn("v0", "(\"__time\" + 3600000)", ColumnType.LONG))
.setDimensions(dimensions(new DefaultDimensionSpec("channel", "d0"),
new DefaultDimensionSpec("cityName", "d1")))
.setDimFilter(
and(
range("channel", ColumnType.STRING, null, "#b", false, true),
range("cityName", ColumnType.STRING, null, "D", false, true)))
.setAggregatorSpecs(new StringLastAggregatorFactory("a0", "cityName", "a0", 128))
.setContext(QUERY_CONTEXT_DEFAULT)
.build()))
// .expectedQueries(
// ImmutableList.of(
// GroupByQuery.builder()
// .setDataSource("wikipedia")
// .setInterval(querySegmentSpec(Filtration.eternity()))
// .setGranularity(Granularities.ALL)
// .setVirtualColumns(
// expressionVirtualColumn("v0", "(\"__time\" + 3600000)", ColumnType.LONG))
// .setDimensions(dimensions(new DefaultDimensionSpec("channel", "d0"),
// new DefaultDimensionSpec("cityName", "d1")))
// .setDimFilter(
// and(
// range("channel", ColumnType.STRING, null, "#b", false, true),
// range("cityName", ColumnType.STRING, null, "B", false, true)))
// .setAggregatorSpecs(new StringLastAggregatorFactory("a0", "cityName", "a0", 128))
// .setContext(QUERY_CONTEXT_DEFAULT)
// .build()))
.expectedResults(ImmutableList.of(
new Object[] {0L}))
.run();