use of org.apache.druid.query.filter.SelectorDimFilter in project druid by druid-io.
the class SelectorFilterTest method testVirtualNumericColumnNullsAndDefaults.
@Test
public void testVirtualNumericColumnNullsAndDefaults() {
if (canTestNumericNullsAsDefaultValues) {
assertFilterMatches(new SelectorDimFilter("vf0", "0", null), ImmutableList.of("0", "4"));
assertFilterMatches(new SelectorDimFilter("vd0", "0", null), ImmutableList.of("0", "2"));
assertFilterMatches(new SelectorDimFilter("vl0", "0", null), ImmutableList.of("0", "3"));
assertFilterMatches(new SelectorDimFilter("vf0", null, null), ImmutableList.of());
assertFilterMatches(new SelectorDimFilter("vd0", null, null), ImmutableList.of());
assertFilterMatches(new SelectorDimFilter("vl0", null, null), ImmutableList.of());
} else {
assertFilterMatches(new SelectorDimFilter("vf0", "0", null), ImmutableList.of("0"));
assertFilterMatches(new SelectorDimFilter("vd0", "0", null), ImmutableList.of("0"));
assertFilterMatches(new SelectorDimFilter("vl0", "0", null), ImmutableList.of("0"));
assertFilterMatches(new SelectorDimFilter("vf0", null, null), ImmutableList.of("4"));
assertFilterMatches(new SelectorDimFilter("vd0", null, null), ImmutableList.of("2"));
assertFilterMatches(new SelectorDimFilter("vl0", null, null), ImmutableList.of("3"));
}
}
use of org.apache.druid.query.filter.SelectorDimFilter in project druid by druid-io.
the class SelectorFilterTest method testMissingColumnSpecifiedInDimensionList.
@Test
public void testMissingColumnSpecifiedInDimensionList() {
assertFilterMatches(new SelectorDimFilter("dim3", null, null), ImmutableList.of("0", "1", "2", "3", "4", "5"));
if (NullHandling.replaceWithDefault()) {
assertFilterMatches(new SelectorDimFilter("dim3", "", null), ImmutableList.of("0", "1", "2", "3", "4", "5"));
} else {
assertFilterMatches(new SelectorDimFilter("dim3", "", null), ImmutableList.of());
}
assertFilterMatches(new SelectorDimFilter("dim3", "a", null), ImmutableList.of());
assertFilterMatches(new SelectorDimFilter("dim3", "b", null), ImmutableList.of());
assertFilterMatches(new SelectorDimFilter("dim3", "c", null), ImmutableList.of());
}
use of org.apache.druid.query.filter.SelectorDimFilter in project druid by druid-io.
the class SelectorFilterTest method testSingleValueVirtualStringColumnWithNulls.
@Test
public void testSingleValueVirtualStringColumnWithNulls() {
// testSingleValueStringColumnWithNulls but with virtual column selector
if (NullHandling.replaceWithDefault()) {
assertFilterMatches(new SelectorDimFilter("vdim1", null, null), ImmutableList.of("0"));
} else {
assertFilterMatches(new SelectorDimFilter("vdim1", null, null), ImmutableList.of());
}
assertFilterMatches(new SelectorDimFilter("vdim1", "", null), ImmutableList.of("0"));
assertFilterMatches(new SelectorDimFilter("vdim1", "10", null), ImmutableList.of("1"));
assertFilterMatches(new SelectorDimFilter("vdim1", "2", null), ImmutableList.of("2"));
assertFilterMatches(new SelectorDimFilter("vdim1", "1", null), ImmutableList.of("3"));
assertFilterMatches(new SelectorDimFilter("vdim1", "abdef", null), ImmutableList.of("4"));
assertFilterMatches(new SelectorDimFilter("vdim1", "abc", null), ImmutableList.of("5"));
assertFilterMatches(new SelectorDimFilter("vdim1", "ab", null), ImmutableList.of());
}
use of org.apache.druid.query.filter.SelectorDimFilter in project druid by druid-io.
the class SelectorFilterTest method testSingleValueStringColumnWithNulls.
@Test
public void testSingleValueStringColumnWithNulls() {
// testSingleValueStringColumnWithoutNulls but with virtual column selector
if (NullHandling.replaceWithDefault()) {
assertFilterMatches(new SelectorDimFilter("dim1", null, null), ImmutableList.of("0"));
} else {
assertFilterMatches(new SelectorDimFilter("dim1", null, null), ImmutableList.of());
}
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", "abdef", null), ImmutableList.of("4"));
assertFilterMatches(new SelectorDimFilter("dim1", "abc", null), ImmutableList.of("5"));
assertFilterMatches(new SelectorDimFilter("dim1", "ab", null), ImmutableList.of());
}
use of org.apache.druid.query.filter.SelectorDimFilter in project druid by druid-io.
the class ExtractionDimFilterTest method testEmpty.
@Test
public void testEmpty() {
Filter extractionFilter = new SelectorDimFilter("foo", "NFDJUKFNDSJFNS", DIM_EXTRACTION_FN).toFilter();
ImmutableBitmap immutableBitmap = extractionFilter.getBitmapIndex(BITMAP_INDEX_SELECTOR);
Assert.assertEquals(0, immutableBitmap.size());
}
Aggregations