Search in sources :

Example 1 with DictionaryEncodedColumnSupplier

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);
}
Also used : DictionaryEncodedColumnSupplier(org.apache.druid.segment.serde.DictionaryEncodedColumnSupplier) Before(org.junit.Before)

Example 2 with DictionaryEncodedColumnSupplier

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());
}
Also used : ValueMatcher(org.apache.druid.query.filter.ValueMatcher) DictionaryEncodedColumnSupplier(org.apache.druid.segment.serde.DictionaryEncodedColumnSupplier) SimpleAscendingOffset(org.apache.druid.segment.SimpleAscendingOffset) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Example 3 with DictionaryEncodedColumnSupplier

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());
}
Also used : ValueMatcher(org.apache.druid.query.filter.ValueMatcher) DictionaryEncodedColumnSupplier(org.apache.druid.segment.serde.DictionaryEncodedColumnSupplier) SimpleAscendingOffset(org.apache.druid.segment.SimpleAscendingOffset) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Aggregations

DictionaryEncodedColumnSupplier (org.apache.druid.segment.serde.DictionaryEncodedColumnSupplier)3 ValueMatcher (org.apache.druid.query.filter.ValueMatcher)2 SimpleAscendingOffset (org.apache.druid.segment.SimpleAscendingOffset)2 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)2 Test (org.junit.Test)2 Before (org.junit.Before)1