use of org.apache.druid.query.filter.ColumnComparisonDimFilter in project druid by druid-io.
the class ColumnComparisonFilterTest method testSelectorWithLookupExtractionFn.
@Test
public void testSelectorWithLookupExtractionFn() {
final Map<String, String> stringMap = ImmutableMap.of("a", "7");
LookupExtractor mapExtractor = new MapLookupExtractor(stringMap, false);
LookupExtractionFn lookupFn = new LookupExtractionFn(mapExtractor, true, null, false, true);
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(new ExtractionDimensionSpec("dim0", "dim0", lookupFn), new ExtractionDimensionSpec("dim1", "dim1", lookupFn))), ImmutableList.of("2", "5", "7", "8"));
}
use of org.apache.druid.query.filter.ColumnComparisonDimFilter in project druid by druid-io.
the class ColumnComparisonFilterTest method testMissingColumnNotSpecifiedInDimensionList.
@Test
public void testMissingColumnNotSpecifiedInDimensionList() {
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim6"), DefaultDimensionSpec.of("dim7"))), ImmutableList.of("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
if (NullHandling.replaceWithDefault()) {
// "" is equivalent to null which is equivalent to a missing dimension
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim1"), DefaultDimensionSpec.of("dim6"))), ImmutableList.of("0"));
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim2"), DefaultDimensionSpec.of("dim6"))), ImmutableList.of("1", "2", "6", "7", "8"));
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim1"), DefaultDimensionSpec.of("dim6"))), ImmutableList.of("0"));
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim2"), DefaultDimensionSpec.of("dim6"))), ImmutableList.of("1", "2", "6", "7", "8"));
} else {
// "" is not equivalent to a missing dimension
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim1"), DefaultDimensionSpec.of("dim6"))), Collections.emptyList());
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim2"), DefaultDimensionSpec.of("dim6"))), ImmutableList.of("1", "6", "7", "8"));
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim1"), DefaultDimensionSpec.of("dim6"))), ImmutableList.of());
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim2"), DefaultDimensionSpec.of("dim6"))), ImmutableList.of("1", "6", "7", "8"));
}
}
use of org.apache.druid.query.filter.ColumnComparisonDimFilter in project druid by druid-io.
the class ColumnComparisonFilterTest method testColumnsWithoutNulls.
@Test
public void testColumnsWithoutNulls() {
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim0"), DefaultDimensionSpec.of("dim1"))), ImmutableList.of("2", "5", "8"));
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim0"), DefaultDimensionSpec.of("dim2"))), ImmutableList.of("3", "4", "5"));
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim1"), DefaultDimensionSpec.of("dim2"))), ImmutableList.of("5", "9"));
assertFilterMatchesSkipVectorize(new ColumnComparisonDimFilter(ImmutableList.of(DefaultDimensionSpec.of("dim0"), DefaultDimensionSpec.of("dim1"), DefaultDimensionSpec.of("dim2"))), ImmutableList.of("5"));
}
Aggregations