use of org.apache.druid.segment.virtual.ListFilteredVirtualColumn in project druid by druid-io.
the class CalciteMultiValueStringQueryTest method testMultiValueListFilterDeny.
@Test
public void testMultiValueListFilterDeny() throws Exception {
// Cannot vectorize due to usage of expressions.
cannotVectorize();
testQuery("SELECT MV_FILTER_NONE(dim3, ARRAY['b']), SUM(cnt) FROM druid.numfoo GROUP BY 1 ORDER BY 2 DESC", ImmutableList.of(GroupByQuery.builder().setDataSource(CalciteTests.DATASOURCE3).setInterval(querySegmentSpec(Filtration.eternity())).setGranularity(Granularities.ALL).setVirtualColumns(new ListFilteredVirtualColumn("v0", DefaultDimensionSpec.of("dim3"), ImmutableSet.of("b"), false)).setDimensions(dimensions(new DefaultDimensionSpec("v0", "_d0", ColumnType.STRING))).setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt"))).setLimitSpec(new DefaultLimitSpec(ImmutableList.of(new OrderByColumnSpec("a0", OrderByColumnSpec.Direction.DESCENDING, StringComparators.NUMERIC)), Integer.MAX_VALUE)).setContext(QUERY_CONTEXT_DEFAULT).build()), useDefault ? ImmutableList.of(new Object[] { NullHandling.defaultStringValue(), 3L }, new Object[] { "a", 1L }, new Object[] { "c", 1L }, new Object[] { "d", 1L }) : ImmutableList.of(new Object[] { NullHandling.defaultStringValue(), 2L }, new Object[] { "", 1L }, new Object[] { "a", 1L }, new Object[] { "c", 1L }, new Object[] { "d", 1L }));
}
use of org.apache.druid.segment.virtual.ListFilteredVirtualColumn in project druid by druid-io.
the class CalciteMultiValueStringQueryTest method testFilterOnMultiValueListFilterMatch.
@Test
public void testFilterOnMultiValueListFilterMatch() throws Exception {
// Cannot vectorize due to usage of expressions.
cannotVectorize();
testQuery("SELECT dim3, SUM(cnt) FROM druid.numfoo WHERE MV_FILTER_ONLY(dim3, ARRAY['b']) = 'b' GROUP BY 1 ORDER BY 2 DESC", ImmutableList.of(GroupByQuery.builder().setDataSource(CalciteTests.DATASOURCE3).setInterval(querySegmentSpec(Filtration.eternity())).setGranularity(Granularities.ALL).setVirtualColumns(new ListFilteredVirtualColumn("v0", DefaultDimensionSpec.of("dim3"), ImmutableSet.of("b"), true)).setDimFilter(selector("v0", "b", null)).setDimensions(dimensions(new DefaultDimensionSpec("dim3", "_d0", ColumnType.STRING))).setAggregatorSpecs(aggregators(new LongSumAggregatorFactory("a0", "cnt"))).setLimitSpec(new DefaultLimitSpec(ImmutableList.of(new OrderByColumnSpec("a0", OrderByColumnSpec.Direction.DESCENDING, StringComparators.NUMERIC)), Integer.MAX_VALUE)).setContext(QUERY_CONTEXT_DEFAULT).build()), ImmutableList.of(new Object[] { "b", 2L }, new Object[] { "a", 1L }, new Object[] { "c", 1L }));
}
Aggregations