Search in sources :

Example 6 with LongColumnSelector

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

the class ExpressionVirtualColumnTest method testLongSelector.

@Test
public void testLongSelector() {
    final LongColumnSelector selector = XPLUSY.makeLongColumnSelector("expr", COLUMN_SELECTOR_FACTORY);
    COLUMN_SELECTOR_FACTORY.setRow(ROW0);
    Assert.assertEquals(0L, selector.get());
    COLUMN_SELECTOR_FACTORY.setRow(ROW1);
    Assert.assertEquals(0L, selector.get());
    COLUMN_SELECTOR_FACTORY.setRow(ROW2);
    Assert.assertEquals(5L, selector.get());
}
Also used : LongColumnSelector(io.druid.segment.LongColumnSelector) Test(org.junit.Test)

Example 7 with LongColumnSelector

use of io.druid.segment.LongColumnSelector 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

LongColumnSelector (io.druid.segment.LongColumnSelector)7 ObjectColumnSelector (io.druid.segment.ObjectColumnSelector)6 DefaultDimensionSpec (io.druid.query.dimension.DefaultDimensionSpec)5 DimensionSelector (io.druid.segment.DimensionSelector)4 FloatColumnSelector (io.druid.segment.FloatColumnSelector)4 Test (org.junit.Test)4 DimensionSpec (io.druid.query.dimension.DimensionSpec)3 Cursor (io.druid.segment.Cursor)3 TestFloatColumnSelector (io.druid.segment.TestFloatColumnSelector)3 TestLongColumnSelector (io.druid.segment.TestLongColumnSelector)3 VirtualColumns (io.druid.segment.VirtualColumns)3 Interval (org.joda.time.Interval)3 ISE (io.druid.java.util.common.ISE)2 Filter (io.druid.query.filter.Filter)2 StorageAdapter (io.druid.segment.StorageAdapter)2 List (java.util.List)2 Map (java.util.Map)2 Function (com.google.common.base.Function)1 BaseSequence (io.druid.java.util.common.guava.BaseSequence)1 QueryInterruptedException (io.druid.query.QueryInterruptedException)1