Search in sources :

Example 6 with VirtualColumns

use of io.druid.segment.VirtualColumns in project druid by druid-io.

the class VirtualColumnsTest method testMakeSelectorsWithDotSupportBaseNameOnly.

@Test
public void testMakeSelectorsWithDotSupportBaseNameOnly() {
    final VirtualColumns virtualColumns = makeVirtualColumns();
    final ObjectColumnSelector objectSelector = virtualColumns.makeObjectColumnSelector("foo", null);
    final DimensionSelector dimensionSelector = virtualColumns.makeDimensionSelector(new DefaultDimensionSpec("foo", "x"), null);
    final FloatColumnSelector floatSelector = virtualColumns.makeFloatColumnSelector("foo", null);
    final LongColumnSelector longSelector = virtualColumns.makeLongColumnSelector("foo", null);
    Assert.assertEquals(-1L, objectSelector.get());
    Assert.assertEquals("-1", dimensionSelector.lookupName(dimensionSelector.getRow().get(0)));
    Assert.assertEquals(-1.0f, floatSelector.get(), 0.0f);
    Assert.assertEquals(-1L, longSelector.get());
}
Also used : DimensionSelector(io.druid.segment.DimensionSelector) TestLongColumnSelector(io.druid.segment.TestLongColumnSelector) LongColumnSelector(io.druid.segment.LongColumnSelector) TestFloatColumnSelector(io.druid.segment.TestFloatColumnSelector) FloatColumnSelector(io.druid.segment.FloatColumnSelector) DefaultDimensionSpec(io.druid.query.dimension.DefaultDimensionSpec) VirtualColumns(io.druid.segment.VirtualColumns) ObjectColumnSelector(io.druid.segment.ObjectColumnSelector) Test(org.junit.Test)

Aggregations

VirtualColumns (io.druid.segment.VirtualColumns)6 Test (org.junit.Test)6 DefaultDimensionSpec (io.druid.query.dimension.DefaultDimensionSpec)3 DimensionSelector (io.druid.segment.DimensionSelector)3 FloatColumnSelector (io.druid.segment.FloatColumnSelector)3 LongColumnSelector (io.druid.segment.LongColumnSelector)3 ObjectColumnSelector (io.druid.segment.ObjectColumnSelector)3 TestFloatColumnSelector (io.druid.segment.TestFloatColumnSelector)3 TestLongColumnSelector (io.druid.segment.TestLongColumnSelector)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)1 ExtractionDimensionSpec (io.druid.query.dimension.ExtractionDimensionSpec)1 BucketExtractionFn (io.druid.query.extraction.BucketExtractionFn)1 VirtualColumn (io.druid.segment.VirtualColumn)1