Search in sources :

Example 41 with ValueMatcher

use of org.apache.druid.query.filter.ValueMatcher in project druid by druid-io.

the class PredicateValueMatcherFactoryTest method testDoubleProcessorNotMatchingValue.

@Test
public void testDoubleProcessorNotMatchingValue() {
    final TestColumnValueSelector<Double> columnValueSelector = TestColumnValueSelector.of(Double.class, ImmutableList.of(2.), DateTimes.nowUtc());
    columnValueSelector.advance();
    final ValueMatcher matcher = forSelector("5.").makeDoubleProcessor(columnValueSelector);
    Assert.assertFalse(matcher.matches());
}
Also used : ValueMatcher(org.apache.druid.query.filter.ValueMatcher) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Example 42 with ValueMatcher

use of org.apache.druid.query.filter.ValueMatcher in project druid by druid-io.

the class PredicateValueMatcherFactoryTest method testComplexProcessorMatchingBoolean.

@Test
public void testComplexProcessorMatchingBoolean() {
    final TestColumnValueSelector<String> columnValueSelector = TestColumnValueSelector.of(String.class, ImmutableList.of(false), DateTimes.nowUtc());
    columnValueSelector.advance();
    final ValueMatcher matcher = forSelector("false").makeComplexProcessor(columnValueSelector);
    Assert.assertTrue(matcher.matches());
}
Also used : ValueMatcher(org.apache.druid.query.filter.ValueMatcher) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Example 43 with ValueMatcher

use of org.apache.druid.query.filter.ValueMatcher in project druid by druid-io.

the class PredicateValueMatcherFactoryTest method testComplexProcessorEmptyString.

@Test
public void testComplexProcessorEmptyString() {
    final TestColumnValueSelector<String> columnValueSelector = TestColumnValueSelector.of(String.class, Arrays.asList("", "v"), DateTimes.nowUtc());
    columnValueSelector.advance();
    final ValueMatcher matcher = forSelector(null).makeComplexProcessor(columnValueSelector);
    if (NullHandling.sqlCompatible()) {
        Assert.assertFalse(matcher.matches());
    } else {
        Assert.assertTrue(matcher.matches());
    }
}
Also used : ValueMatcher(org.apache.druid.query.filter.ValueMatcher) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Example 44 with ValueMatcher

use of org.apache.druid.query.filter.ValueMatcher in project druid by druid-io.

the class PredicateValueMatcherFactoryTest method testComplexProcessorMatchingLong.

@Test
public void testComplexProcessorMatchingLong() {
    final TestColumnValueSelector<Long> columnValueSelector = TestColumnValueSelector.of(Long.class, ImmutableList.of(11L), DateTimes.nowUtc());
    columnValueSelector.advance();
    final ValueMatcher matcher = forSelector("11").makeComplexProcessor(columnValueSelector);
    Assert.assertTrue(matcher.matches());
}
Also used : ValueMatcher(org.apache.druid.query.filter.ValueMatcher) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Example 45 with ValueMatcher

use of org.apache.druid.query.filter.ValueMatcher in project druid by druid-io.

the class PredicateValueMatcherFactoryTest method testDoubleProcessorMatchingValue.

@Test
public void testDoubleProcessorMatchingValue() {
    final TestColumnValueSelector<Double> columnValueSelector = TestColumnValueSelector.of(Double.class, ImmutableList.of(2.), DateTimes.nowUtc());
    columnValueSelector.advance();
    final ValueMatcher matcher = forSelector("2.").makeDoubleProcessor(columnValueSelector);
    Assert.assertTrue(matcher.matches());
}
Also used : ValueMatcher(org.apache.druid.query.filter.ValueMatcher) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Aggregations

ValueMatcher (org.apache.druid.query.filter.ValueMatcher)59 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)33 Test (org.junit.Test)33 RuntimeShapeInspector (org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector)19 IndexedInts (org.apache.druid.segment.data.IndexedInts)11 BooleanValueMatcher (org.apache.druid.segment.filter.BooleanValueMatcher)9 VectorValueMatcher (org.apache.druid.query.filter.vector.VectorValueMatcher)7 BaseVectorValueMatcher (org.apache.druid.query.filter.vector.BaseVectorValueMatcher)6 ArrayList (java.util.ArrayList)5 BitSet (java.util.BitSet)5 Nullable (javax.annotation.Nullable)5 Filter (org.apache.druid.query.filter.Filter)5 DimensionSelector (org.apache.druid.segment.DimensionSelector)5 ArrayBasedIndexedInts (org.apache.druid.segment.data.ArrayBasedIndexedInts)5 Predicate (com.google.common.base.Predicate)4 IdLookup (org.apache.druid.segment.IdLookup)4 DefaultDimensionSpec (org.apache.druid.query.dimension.DefaultDimensionSpec)3 BooleanFilter (org.apache.druid.query.filter.BooleanFilter)3 ConstantDimensionSelector (org.apache.druid.segment.ConstantDimensionSelector)3 ConstantMultiValueDimensionSelector (org.apache.druid.segment.ConstantMultiValueDimensionSelector)3