Search in sources :

Example 71 with SelectorDimFilter

use of io.druid.query.filter.SelectorDimFilter in project druid by druid-io.

the class NotFilterTest method testNotSelector.

@Test
public void testNotSelector() {
    assertFilterMatches(new NotDimFilter(new SelectorDimFilter("dim0", null, null)), ImmutableList.of("0", "1", "2", "3", "4", "5"));
    assertFilterMatches(new NotDimFilter(new SelectorDimFilter("dim0", "", null)), ImmutableList.of("0", "1", "2", "3", "4", "5"));
    assertFilterMatches(new NotDimFilter(new SelectorDimFilter("dim0", "0", null)), ImmutableList.of("1", "2", "3", "4", "5"));
    assertFilterMatches(new NotDimFilter(new SelectorDimFilter("dim0", "1", null)), ImmutableList.of("0", "2", "3", "4", "5"));
}
Also used : NotDimFilter(io.druid.query.filter.NotDimFilter) SelectorDimFilter(io.druid.query.filter.SelectorDimFilter) Test(org.junit.Test)

Example 72 with SelectorDimFilter

use of io.druid.query.filter.SelectorDimFilter in project druid by druid-io.

the class SelectorFilterTest method testMissingColumnNotSpecifiedInDimensionList.

@Test
public void testMissingColumnNotSpecifiedInDimensionList() {
    assertFilterMatches(new SelectorDimFilter("dim4", null, null), ImmutableList.of("0", "1", "2", "3", "4", "5"));
    assertFilterMatches(new SelectorDimFilter("dim4", "", null), ImmutableList.of("0", "1", "2", "3", "4", "5"));
    assertFilterMatches(new SelectorDimFilter("dim4", "a", null), ImmutableList.<String>of());
    assertFilterMatches(new SelectorDimFilter("dim4", "b", null), ImmutableList.<String>of());
    assertFilterMatches(new SelectorDimFilter("dim4", "c", null), ImmutableList.<String>of());
}
Also used : SelectorDimFilter(io.druid.query.filter.SelectorDimFilter) Test(org.junit.Test)

Example 73 with SelectorDimFilter

use of io.druid.query.filter.SelectorDimFilter in project druid by druid-io.

the class SelectorFilterTest method testSingleValueStringColumnWithoutNulls.

@Test
public void testSingleValueStringColumnWithoutNulls() {
    assertFilterMatches(new SelectorDimFilter("dim0", null, null), ImmutableList.<String>of());
    assertFilterMatches(new SelectorDimFilter("dim0", "", null), ImmutableList.<String>of());
    assertFilterMatches(new SelectorDimFilter("dim0", "0", null), ImmutableList.of("0"));
    assertFilterMatches(new SelectorDimFilter("dim0", "1", null), ImmutableList.of("1"));
}
Also used : SelectorDimFilter(io.druid.query.filter.SelectorDimFilter) Test(org.junit.Test)

Example 74 with SelectorDimFilter

use of io.druid.query.filter.SelectorDimFilter in project druid by druid-io.

the class SelectorFilterTest method testExpressionVirtualColumn.

@Test
public void testExpressionVirtualColumn() {
    assertFilterMatches(new SelectorDimFilter("expr", "1.1", null), ImmutableList.of("0", "1", "2", "3", "4", "5"));
    assertFilterMatches(new SelectorDimFilter("expr", "1.2", null), ImmutableList.<String>of());
}
Also used : SelectorDimFilter(io.druid.query.filter.SelectorDimFilter) Test(org.junit.Test)

Example 75 with SelectorDimFilter

use of io.druid.query.filter.SelectorDimFilter in project druid by druid-io.

the class SelectorFilterTest method testSingleValueStringColumnWithNulls.

@Test
public void testSingleValueStringColumnWithNulls() {
    assertFilterMatches(new SelectorDimFilter("dim1", null, null), ImmutableList.of("0"));
    assertFilterMatches(new SelectorDimFilter("dim1", "", null), ImmutableList.of("0"));
    assertFilterMatches(new SelectorDimFilter("dim1", "10", null), ImmutableList.of("1"));
    assertFilterMatches(new SelectorDimFilter("dim1", "2", null), ImmutableList.of("2"));
    assertFilterMatches(new SelectorDimFilter("dim1", "1", null), ImmutableList.of("3"));
    assertFilterMatches(new SelectorDimFilter("dim1", "def", null), ImmutableList.of("4"));
    assertFilterMatches(new SelectorDimFilter("dim1", "abc", null), ImmutableList.of("5"));
    assertFilterMatches(new SelectorDimFilter("dim1", "ab", null), ImmutableList.<String>of());
}
Also used : SelectorDimFilter(io.druid.query.filter.SelectorDimFilter) Test(org.junit.Test)

Aggregations

SelectorDimFilter (io.druid.query.filter.SelectorDimFilter)93 Test (org.junit.Test)83 BoundDimFilter (io.druid.query.filter.BoundDimFilter)34 AndDimFilter (io.druid.query.filter.AndDimFilter)26 DimFilter (io.druid.query.filter.DimFilter)25 InDimFilter (io.druid.query.filter.InDimFilter)25 OrDimFilter (io.druid.query.filter.OrDimFilter)23 LongSumAggregatorFactory (io.druid.query.aggregation.LongSumAggregatorFactory)22 Row (io.druid.data.input.Row)21 DefaultDimensionSpec (io.druid.query.dimension.DefaultDimensionSpec)20 ExtractionDimensionSpec (io.druid.query.dimension.ExtractionDimensionSpec)18 LookupExtractionFn (io.druid.query.lookup.LookupExtractionFn)18 JavaScriptDimFilter (io.druid.query.filter.JavaScriptDimFilter)16 RegexDimFilter (io.druid.query.filter.RegexDimFilter)16 SearchQueryDimFilter (io.druid.query.filter.SearchQueryDimFilter)16 ArrayList (java.util.ArrayList)16 Result (io.druid.query.Result)12 ListFilteredDimensionSpec (io.druid.query.dimension.ListFilteredDimensionSpec)12 DateTime (org.joda.time.DateTime)12 DimensionSpec (io.druid.query.dimension.DimensionSpec)11