use of org.apache.druid.segment.serde.DictionaryEncodedColumnSupplier in project druid by druid-io.
the class ValueMatchersTest method setup.
@Before
public void setup() {
supplierSingleConstant = new DictionaryEncodedColumnSupplier(GenericIndexed.fromIterable(ImmutableList.of("value"), GenericIndexed.STRING_STRATEGY), GenericIndexed.fromIterable(ImmutableList.of(ByteBuffer.wrap(StringUtils.toUtf8("value"))), GenericIndexed.BYTE_BUFFER_STRATEGY), () -> VSizeColumnarInts.fromArray(new int[] { 0 }), null, 0);
supplierSingle = new DictionaryEncodedColumnSupplier(GenericIndexed.fromIterable(ImmutableList.of("value", "value2"), GenericIndexed.STRING_STRATEGY), GenericIndexed.fromIterable(ImmutableList.of(ByteBuffer.wrap(StringUtils.toUtf8("value")), ByteBuffer.wrap(StringUtils.toUtf8("value2"))), GenericIndexed.BYTE_BUFFER_STRATEGY), () -> VSizeColumnarInts.fromArray(new int[] { 0, 0, 1, 0, 1 }), null, 0);
supplierMulti = new DictionaryEncodedColumnSupplier(GenericIndexed.fromIterable(ImmutableList.of("value"), GenericIndexed.STRING_STRATEGY), GenericIndexed.fromIterable(ImmutableList.of(ByteBuffer.wrap(StringUtils.toUtf8("value"))), GenericIndexed.BYTE_BUFFER_STRATEGY), null, () -> VSizeColumnarMultiInts.fromIterable(ImmutableList.of(VSizeColumnarInts.fromArray(new int[] { 0, 0 }), VSizeColumnarInts.fromArray(new int[] { 0 }))), 0);
}
use of org.apache.druid.segment.serde.DictionaryEncodedColumnSupplier 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());
}
use of org.apache.druid.segment.serde.DictionaryEncodedColumnSupplier in project druid by druid-io.
the class PredicateValueMatcherFactoryTest method testDimensionProcessorMultiValuedDimensionNotMatchingValue.
@Test
public void testDimensionProcessorMultiValuedDimensionNotMatchingValue() {
// 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("v3").makeDimensionProcessor(columnSupplier.get().makeDimensionSelector(new SimpleAscendingOffset(1), null), true);
Assert.assertFalse(matcher.matches());
}
Aggregations