diff --git a/processing/src/main/java/org/apache/druid/segment/filter/PredicateValueMatcherFactory.java b/processing/src/main/java/org/apache/druid/segment/filter/PredicateValueMatcherFactory.java index 796177a4c79..0709f8e1836 100644 --- a/processing/src/main/java/org/apache/druid/segment/filter/PredicateValueMatcherFactory.java +++ b/processing/src/main/java/org/apache/druid/segment/filter/PredicateValueMatcherFactory.java @@ -189,7 +189,7 @@ public class PredicateValueMatcherFactory implements ColumnProcessorFactory columnValueSelector = TestColumnValueSelector.of( + Number.class, + ImmutableList.of(new Number() { + @Override + public int intValue() + { + return num.intValue(); + } + + @Override + public long longValue() + { + return num.longValue(); + } + + @Override + public float floatValue() + { + return num.floatValue(); + } + + @Override + public double doubleValue() + { + return num; + } + }), + DateTimes.nowUtc() + ); + columnValueSelector.advance(); + final ValueMatcher matcher = forSelector("2").makeComplexProcessor(columnValueSelector); + Assert.assertTrue(matcher.matches(false)); + } + + @Test + public void testNumberProcessorNotMatchingValue() + { + Double num = 2.; + final TestColumnValueSelector columnValueSelector = TestColumnValueSelector.of( + Double.class, + ImmutableList.of(new Number() { + @Override + public int intValue() + { + return num.intValue(); + } + + @Override + public long longValue() + { + return num.longValue(); + } + + @Override + public float floatValue() + { + return num.floatValue(); + } + + @Override + public double doubleValue() + { + return num; + } + }), + DateTimes.nowUtc() + ); + columnValueSelector.advance(); + final ValueMatcher matcher = forSelector("5").makeComplexProcessor(columnValueSelector); + Assert.assertFalse(matcher.matches(false)); + } + @Test public void testLongProcessorMatchingValue() {