use of org.apache.druid.segment.column.ColumnCapabilities in project druid by druid-io.
the class RowBasedStorageAdapterTest method test_getColumnCapabilities_string.
@Test
public void test_getColumnCapabilities_string() {
final RowBasedStorageAdapter<Integer> adapter = createIntAdapter(0, 1, 2);
final ColumnCapabilities capabilities = adapter.getColumnCapabilities(ValueType.STRING.name());
Assert.assertEquals(ValueType.STRING, capabilities.getType());
// Note: unlike numeric types, STRING-typed columns might have multiple values, so they report as incomplete. It
// would be good in the future to support some way of changing this, when it is known ahead of time that
// multi-valuedness is definitely happening or is definitely impossible.
Assert.assertTrue(capabilities.hasMultipleValues().isUnknown());
}
use of org.apache.druid.segment.column.ColumnCapabilities in project druid by druid-io.
the class QueryableIndexColumnCapabilitiesTest method testStringColumn.
@Test
public void testStringColumn() {
ColumnCapabilities caps = INC_INDEX.getColumnCapabilities("d1");
Assert.assertEquals(ValueType.STRING, caps.getType());
Assert.assertTrue(caps.hasBitmapIndexes());
Assert.assertTrue(caps.isDictionaryEncoded().isMaybeTrue());
Assert.assertTrue(caps.isDictionaryEncoded().isTrue());
Assert.assertFalse(caps.areDictionaryValuesSorted().isTrue());
Assert.assertTrue(caps.areDictionaryValuesUnique().isTrue());
// multi-value is unknown unless explicitly set to 'true'
Assert.assertTrue(caps.hasMultipleValues().isUnknown());
// at index merge or query time we 'complete' the capabilities to take a snapshot of the current state,
// coercing any 'UNKNOWN' values to false
Assert.assertFalse(ColumnCapabilitiesImpl.snapshot(caps, IndexMergerV9.DIMENSION_CAPABILITY_MERGE_LOGIC).hasMultipleValues().isMaybeTrue());
Assert.assertFalse(caps.hasSpatialIndexes());
Assert.assertTrue(caps.hasNulls().isUnknown());
caps = MMAP_INDEX.getColumnHolder("d1").getCapabilities();
Assert.assertEquals(ValueType.STRING, caps.getType());
Assert.assertTrue(caps.hasBitmapIndexes());
Assert.assertTrue(caps.isDictionaryEncoded().isTrue());
Assert.assertTrue(caps.areDictionaryValuesSorted().isTrue());
Assert.assertTrue(caps.areDictionaryValuesUnique().isTrue());
Assert.assertFalse(caps.hasMultipleValues().isMaybeTrue());
Assert.assertFalse(caps.hasSpatialIndexes());
Assert.assertFalse(caps.hasNulls().isMaybeTrue());
}
use of org.apache.druid.segment.column.ColumnCapabilities in project druid by druid-io.
the class QueryableIndexColumnCapabilitiesTest method testMultiStringColumn.
@Test
public void testMultiStringColumn() {
ColumnCapabilities caps = INC_INDEX.getColumnCapabilities("d2");
Assert.assertEquals(ValueType.STRING, caps.getType());
Assert.assertTrue(caps.hasBitmapIndexes());
Assert.assertTrue(caps.isDictionaryEncoded().isTrue());
Assert.assertFalse(caps.areDictionaryValuesSorted().isTrue());
Assert.assertTrue(caps.areDictionaryValuesUnique().isTrue());
Assert.assertTrue(caps.hasMultipleValues().isTrue());
Assert.assertFalse(caps.hasSpatialIndexes());
Assert.assertTrue(caps.hasNulls().isUnknown());
caps = MMAP_INDEX.getColumnHolder("d2").getCapabilities();
Assert.assertEquals(ValueType.STRING, caps.getType());
Assert.assertTrue(caps.hasBitmapIndexes());
Assert.assertTrue(caps.isDictionaryEncoded().isTrue());
Assert.assertTrue(caps.areDictionaryValuesSorted().isTrue());
Assert.assertTrue(caps.areDictionaryValuesUnique().isTrue());
Assert.assertTrue(caps.hasMultipleValues().isTrue());
Assert.assertFalse(caps.hasSpatialIndexes());
Assert.assertFalse(caps.hasNulls().isMaybeTrue());
}
use of org.apache.druid.segment.column.ColumnCapabilities in project druid by druid-io.
the class QueryableIndexColumnCapabilitiesTest method testMultiStringColumnWithNulls.
@Test
public void testMultiStringColumnWithNulls() {
ColumnCapabilities caps = INC_INDEX_WITH_NULLS.getColumnCapabilities("d2");
Assert.assertEquals(ValueType.STRING, caps.getType());
Assert.assertTrue(caps.hasBitmapIndexes());
Assert.assertTrue(caps.isDictionaryEncoded().isTrue());
Assert.assertFalse(caps.areDictionaryValuesSorted().isTrue());
Assert.assertTrue(caps.areDictionaryValuesUnique().isTrue());
Assert.assertTrue(caps.hasMultipleValues().isTrue());
Assert.assertFalse(caps.hasSpatialIndexes());
Assert.assertTrue(caps.hasNulls().isTrue());
caps = MMAP_INDEX_WITH_NULLS.getColumnHolder("d2").getCapabilities();
Assert.assertEquals(ValueType.STRING, caps.getType());
Assert.assertTrue(caps.hasBitmapIndexes());
Assert.assertTrue(caps.isDictionaryEncoded().isTrue());
Assert.assertTrue(caps.areDictionaryValuesSorted().isTrue());
Assert.assertTrue(caps.areDictionaryValuesUnique().isTrue());
Assert.assertTrue(caps.hasMultipleValues().isTrue());
Assert.assertFalse(caps.hasSpatialIndexes());
Assert.assertTrue(caps.hasNulls().isTrue());
}
use of org.apache.druid.segment.column.ColumnCapabilities in project druid by druid-io.
the class RowBasedColumnSelectorFactoryTest method testCapabilitiesUnknownColumn.
@Test
public void testCapabilitiesUnknownColumn() {
ColumnCapabilities caps = RowBasedColumnSelectorFactory.getColumnCapabilities(ROW_SIGNATURE, "wat");
Assert.assertNull(caps);
}
Aggregations