use of org.apache.druid.query.filter.ValueMatcher in project druid by druid-io.
the class PredicateValueMatcherFactoryTest method testComplexProcessorMatchingInteger.
@Test
public void testComplexProcessorMatchingInteger() {
final TestColumnValueSelector<Integer> columnValueSelector = TestColumnValueSelector.of(Integer.class, ImmutableList.of(11), DateTimes.nowUtc());
columnValueSelector.advance();
final ValueMatcher matcher = forSelector("11").makeComplexProcessor(columnValueSelector);
Assert.assertTrue(matcher.matches());
}
use of org.apache.druid.query.filter.ValueMatcher in project druid by druid-io.
the class PredicateValueMatcherFactoryTest method testComplexProcessorNotMatchingByteArray.
@Test
public void testComplexProcessorNotMatchingByteArray() {
final TestColumnValueSelector<String> columnValueSelector = TestColumnValueSelector.of(String.class, ImmutableList.of(StringUtils.toUtf8("var")), DateTimes.nowUtc());
columnValueSelector.advance();
final ValueMatcher matcher = forSelector("val").makeComplexProcessor(columnValueSelector);
Assert.assertFalse(matcher.matches());
}
use of org.apache.druid.query.filter.ValueMatcher in project druid by druid-io.
the class PredicateValueMatcherFactoryTest method testComplexProcessorNotMatchingFloat.
@Test
public void testComplexProcessorNotMatchingFloat() {
final TestColumnValueSelector<Float> columnValueSelector = TestColumnValueSelector.of(Float.class, ImmutableList.of(15.f), DateTimes.nowUtc());
columnValueSelector.advance();
final ValueMatcher matcher = forSelector("11.f").makeComplexProcessor(columnValueSelector);
Assert.assertFalse(matcher.matches());
}
use of org.apache.druid.query.filter.ValueMatcher in project druid by druid-io.
the class PredicateValueMatcherFactoryTest method testComplexProcessorNotMatchingString.
@Test
public void testComplexProcessorNotMatchingString() {
final TestColumnValueSelector<String> columnValueSelector = TestColumnValueSelector.of(String.class, ImmutableList.of("bar"), DateTimes.nowUtc());
columnValueSelector.advance();
final ValueMatcher matcher = forSelector("val").makeComplexProcessor(columnValueSelector);
Assert.assertFalse(matcher.matches());
}
use of org.apache.druid.query.filter.ValueMatcher in project druid by druid-io.
the class PredicateValueMatcherFactoryTest method testDimensionProcessorMultiValuedDimensionMatchingValue.
@Test
public void testDimensionProcessorMultiValuedDimensionMatchingValue() {
// Emulate multi-valued dimension
final DictionaryEncodedColumnSupplier columnSupplier = new DictionaryEncodedColumnSupplier(GenericIndexed.fromIterable(ImmutableList.of("v1", "v2", "v3"), GenericIndexed.STRING_STRATEGY), GenericIndexed.fromIterable(ImmutableList.of(ByteBuffer.wrap(StringUtils.toUtf8("v1")), ByteBuffer.wrap(StringUtils.toUtf8("v2")), ByteBuffer.wrap(StringUtils.toUtf8("v3"))), GenericIndexed.BYTE_BUFFER_STRATEGY), null, () -> VSizeColumnarMultiInts.fromIterable(ImmutableList.of(VSizeColumnarInts.fromArray(new int[] { 1 }))), 0);
final ValueMatcher matcher = forSelector("v2").makeDimensionProcessor(columnSupplier.get().makeDimensionSelector(new SimpleAscendingOffset(1), null), true);
Assert.assertTrue(matcher.matches());
}
Aggregations