use of org.apache.druid.segment.column.ColumnCapabilitiesImpl in project druid by druid-io.
the class VectorValueMatcherColumnProcessorFactoryTest method testSingleValueStringOneCardinalityBooleanMatcherIfNullAndNameLookupPossible.
@Test
public void testSingleValueStringOneCardinalityBooleanMatcherIfNullAndNameLookupPossible() {
// single value string column with cardinality 1 and name lookup possible in advance uses boolean matcher for
// matches
SingleValueDimensionVectorSelector selector = EasyMock.createMock(SingleValueDimensionVectorSelector.class);
EasyMock.expect(selector.getCurrentVectorSize()).andReturn(CURRENT_SIZE).anyTimes();
EasyMock.expect(selector.getMaxVectorSize()).andReturn(VECTOR_SIZE).anyTimes();
EasyMock.expect(selector.getValueCardinality()).andReturn(1).anyTimes();
EasyMock.expect(selector.nameLookupPossibleInAdvance()).andReturn(true).anyTimes();
EasyMock.expect(selector.lookupName(0)).andReturn(null).anyTimes();
EasyMock.replay(selector);
VectorValueMatcherFactory matcherFactory = VectorValueMatcherColumnProcessorFactory.instance().makeSingleValueDimensionProcessor(new ColumnCapabilitiesImpl().setType(ColumnType.STRING).setHasMultipleValues(false).setHasBitmapIndexes(true).setDictionaryValuesUnique(true).setDictionaryValuesSorted(true).setDictionaryEncoded(true), selector);
Assert.assertTrue(matcherFactory instanceof SingleValueStringVectorValueMatcher);
// false matcher
VectorValueMatcher booleanMatcher = matcherFactory.makeMatcher("any value");
Assert.assertTrue(booleanMatcher instanceof BooleanVectorValueMatcher);
Assert.assertEquals(VECTOR_SIZE, booleanMatcher.getMaxVectorSize());
Assert.assertEquals(CURRENT_SIZE, booleanMatcher.getCurrentVectorSize());
// true matcher
VectorValueMatcher anotherBooleanMatcher = matcherFactory.makeMatcher((String) null);
Assert.assertTrue(anotherBooleanMatcher instanceof BooleanVectorValueMatcher);
Assert.assertEquals(VECTOR_SIZE, anotherBooleanMatcher.getMaxVectorSize());
Assert.assertEquals(CURRENT_SIZE, anotherBooleanMatcher.getCurrentVectorSize());
EasyMock.verify(selector);
}
use of org.apache.druid.segment.column.ColumnCapabilitiesImpl in project druid by druid-io.
the class DimensionHandlerUtilsTest method testGetHandlerFromUnknownComplexCapabilities.
@Test
public void testGetHandlerFromUnknownComplexCapabilities() {
expectedException.expect(ISE.class);
expectedException.expectMessage("Can't find DimensionHandlerProvider for typeName [unknown]");
ColumnCapabilities capabilities = new ColumnCapabilitiesImpl().setType(ColumnType.ofComplex("unknown"));
DimensionHandlerUtils.getHandlerFromCapabilities(DIM_NAME, capabilities, null);
}
use of org.apache.druid.segment.column.ColumnCapabilitiesImpl in project druid by druid-io.
the class DimensionHandlerUtilsTest method testGetHandlerFromComplexCapabilities.
@Test
public void testGetHandlerFromComplexCapabilities() {
ColumnCapabilities capabilities = new ColumnCapabilitiesImpl().setType(ColumnType.ofComplex(TYPE));
DimensionHandler dimensionHandler = DimensionHandlerUtils.getHandlerFromCapabilities(DIM_NAME, capabilities, null);
Assert.assertEquals(DIM_NAME, dimensionHandler.getDimensionName());
Assert.assertTrue(dimensionHandler instanceof DoubleDimensionHandler);
Assert.assertTrue(dimensionHandler.getDimensionSchema(capabilities) instanceof TestDimensionSchema);
}
use of org.apache.druid.segment.column.ColumnCapabilitiesImpl in project druid by druid-io.
the class VectorizedVirtualColumnTest method testGroupByForceVirtualContextCannotVectorize.
@Test
public void testGroupByForceVirtualContextCannotVectorize() {
cannotVectorize();
testGroupBy(new ColumnCapabilitiesImpl().setType(ColumnType.STRING).setDictionaryEncoded(true).setDictionaryValuesUnique(true).setHasMultipleValues(false), CONTEXT_VECTORIZE_TRUE_VIRTUAL_FORCE, false);
}
use of org.apache.druid.segment.column.ColumnCapabilitiesImpl in project druid by druid-io.
the class VectorizedVirtualColumnTest method testGroupByMultiValueStringNotDictionaryEncoded.
@Test
public void testGroupByMultiValueStringNotDictionaryEncoded() {
// cannot currently group by string columns that might be multi valued
cannotVectorize();
testGroupBy(new ColumnCapabilitiesImpl().setType(ColumnType.STRING).setDictionaryEncoded(false).setDictionaryValuesUnique(false).setHasMultipleValues(true));
}
Aggregations