Search in sources :

Example 26 with ColumnCapabilitiesImpl

use of org.apache.druid.segment.column.ColumnCapabilitiesImpl in project druid by druid-io.

the class StringAnyAggregationTest method testStringAnyAggregatorWithNullFirst.

@Test
public void testStringAnyAggregatorWithNullFirst() {
    valueSelector = new TestObjectColumnSelector<>(stringsWithNullFirst);
    colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
    EasyMock.expect(colSelectorFactory.getColumnCapabilities("nilly")).andReturn(new ColumnCapabilitiesImpl().setType(ColumnType.STRING));
    EasyMock.expect(colSelectorFactory.makeColumnValueSelector("nilly")).andReturn(valueSelector);
    EasyMock.replay(colSelectorFactory);
    Aggregator agg = stringAnyAggFactory.factorize(colSelectorFactory);
    aggregate(agg);
    aggregate(agg);
    aggregate(agg);
    aggregate(agg);
    String result = (String) agg.get();
    Assert.assertNull(result);
}
Also used : ColumnSelectorFactory(org.apache.druid.segment.ColumnSelectorFactory) BufferAggregator(org.apache.druid.query.aggregation.BufferAggregator) Aggregator(org.apache.druid.query.aggregation.Aggregator) ColumnCapabilitiesImpl(org.apache.druid.segment.column.ColumnCapabilitiesImpl) Test(org.junit.Test)

Example 27 with ColumnCapabilitiesImpl

use of org.apache.druid.segment.column.ColumnCapabilitiesImpl in project druid by druid-io.

the class DoubleMaxAggregationTest method setup.

@Before
public void setup() {
    NullHandling.initializeForTests();
    selector = new TestDoubleColumnSelectorImpl(values);
    colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
    EasyMock.expect(colSelectorFactory.makeColumnValueSelector("nilly")).andReturn(selector);
    EasyMock.expect(colSelectorFactory.getColumnCapabilities("nilly")).andReturn(null);
    EasyMock.replay(colSelectorFactory);
    VectorValueSelector vectorValueSelector = EasyMock.createMock(VectorValueSelector.class);
    EasyMock.expect(vectorValueSelector.getDoubleVector()).andReturn(doubleValues1).anyTimes();
    EasyMock.expect(vectorValueSelector.getNullVector()).andReturn(null).anyTimes();
    EasyMock.replay(vectorValueSelector);
    vectorColumnSelectorFactory = EasyMock.createMock(VectorColumnSelectorFactory.class);
    EasyMock.expect(vectorColumnSelectorFactory.getColumnCapabilities("dblFld")).andReturn(new ColumnCapabilitiesImpl().setType(ColumnType.DOUBLE).setDictionaryEncoded(true)).anyTimes();
    EasyMock.expect(vectorColumnSelectorFactory.makeValueSelector("dblFld")).andReturn(vectorValueSelector).anyTimes();
    EasyMock.replay(vectorColumnSelectorFactory);
}
Also used : ColumnSelectorFactory(org.apache.druid.segment.ColumnSelectorFactory) VectorColumnSelectorFactory(org.apache.druid.segment.vector.VectorColumnSelectorFactory) VectorValueSelector(org.apache.druid.segment.vector.VectorValueSelector) VectorColumnSelectorFactory(org.apache.druid.segment.vector.VectorColumnSelectorFactory) ColumnCapabilitiesImpl(org.apache.druid.segment.column.ColumnCapabilitiesImpl) Before(org.junit.Before)

Example 28 with ColumnCapabilitiesImpl

use of org.apache.druid.segment.column.ColumnCapabilitiesImpl in project druid by druid-io.

the class DoubleMinAggregationTest method setup.

@Before
public void setup() {
    NullHandling.initializeForTests();
    selector = new TestDoubleColumnSelectorImpl(values);
    colSelectorFactory = EasyMock.createMock(ColumnSelectorFactory.class);
    EasyMock.expect(colSelectorFactory.makeColumnValueSelector("nilly")).andReturn(selector);
    EasyMock.expect(colSelectorFactory.getColumnCapabilities("nilly")).andReturn(null);
    EasyMock.replay(colSelectorFactory);
    VectorValueSelector vectorValueSelector = EasyMock.createMock(VectorValueSelector.class);
    EasyMock.expect(vectorValueSelector.getDoubleVector()).andReturn(doubleValues1).anyTimes();
    EasyMock.expect(vectorValueSelector.getNullVector()).andReturn(null).anyTimes();
    EasyMock.replay(vectorValueSelector);
    vectorColumnSelectorFactory = EasyMock.createMock(VectorColumnSelectorFactory.class);
    EasyMock.expect(vectorColumnSelectorFactory.getColumnCapabilities("dblFld")).andReturn(new ColumnCapabilitiesImpl().setType(ColumnType.DOUBLE).setDictionaryEncoded(true)).anyTimes();
    EasyMock.expect(vectorColumnSelectorFactory.makeValueSelector("dblFld")).andReturn(vectorValueSelector).anyTimes();
    EasyMock.replay(vectorColumnSelectorFactory);
}
Also used : ColumnSelectorFactory(org.apache.druid.segment.ColumnSelectorFactory) VectorColumnSelectorFactory(org.apache.druid.segment.vector.VectorColumnSelectorFactory) VectorValueSelector(org.apache.druid.segment.vector.VectorValueSelector) VectorColumnSelectorFactory(org.apache.druid.segment.vector.VectorColumnSelectorFactory) ColumnCapabilitiesImpl(org.apache.druid.segment.column.ColumnCapabilitiesImpl) Before(org.junit.Before)

Example 29 with ColumnCapabilitiesImpl

use of org.apache.druid.segment.column.ColumnCapabilitiesImpl in project druid by druid-io.

the class FloatMinAggregationTest method setup.

@Before
public void setup() {
    NullHandling.initializeForTests();
    VectorValueSelector vectorValueSelector = EasyMock.createMock(VectorValueSelector.class);
    EasyMock.expect(vectorValueSelector.getFloatVector()).andReturn(floatValues1).anyTimes();
    EasyMock.expect(vectorValueSelector.getNullVector()).andReturn(null).anyTimes();
    EasyMock.replay(vectorValueSelector);
    vectorColumnSelectorFactory = EasyMock.createMock(VectorColumnSelectorFactory.class);
    EasyMock.expect(vectorColumnSelectorFactory.getColumnCapabilities("fltFld")).andReturn(new ColumnCapabilitiesImpl().setType(ColumnType.FLOAT).setDictionaryEncoded(true)).anyTimes();
    EasyMock.expect(vectorColumnSelectorFactory.makeValueSelector("fltFld")).andReturn(vectorValueSelector).anyTimes();
    EasyMock.replay(vectorColumnSelectorFactory);
}
Also used : VectorValueSelector(org.apache.druid.segment.vector.VectorValueSelector) VectorColumnSelectorFactory(org.apache.druid.segment.vector.VectorColumnSelectorFactory) ColumnCapabilitiesImpl(org.apache.druid.segment.column.ColumnCapabilitiesImpl) Before(org.junit.Before)

Example 30 with ColumnCapabilitiesImpl

use of org.apache.druid.segment.column.ColumnCapabilitiesImpl in project druid by druid-io.

the class GroupByQueryEngineV2Test method testCanPushDownLimitForExpressionStringSelector.

@Test
public void testCanPushDownLimitForExpressionStringSelector() {
    ColumnCapabilities capabilities = new ColumnCapabilitiesImpl().setType(ColumnType.STRING).setHasBitmapIndexes(false).setHasMultipleValues(false).setDictionaryEncoded(false).setDictionaryValuesSorted(false).setDictionaryValuesUnique(false);
    EasyMock.expect(factory.getColumnCapabilities(DIM)).andReturn(capabilities).once();
    EasyMock.replay(factory);
    Assert.assertFalse(GroupByQueryEngineV2.canPushDownLimit(factory, DIM));
    EasyMock.verify(factory);
}
Also used : ColumnCapabilities(org.apache.druid.segment.column.ColumnCapabilities) ColumnCapabilitiesImpl(org.apache.druid.segment.column.ColumnCapabilitiesImpl) Test(org.junit.Test)

Aggregations

ColumnCapabilitiesImpl (org.apache.druid.segment.column.ColumnCapabilitiesImpl)34 Test (org.junit.Test)20 ColumnSelectorFactory (org.apache.druid.segment.ColumnSelectorFactory)11 Before (org.junit.Before)10 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)9 ColumnCapabilities (org.apache.druid.segment.column.ColumnCapabilities)8 VectorColumnSelectorFactory (org.apache.druid.segment.vector.VectorColumnSelectorFactory)8 VectorValueSelector (org.apache.druid.segment.vector.VectorValueSelector)7 IdLookup (org.apache.druid.segment.IdLookup)5 SingleValueDimensionVectorSelector (org.apache.druid.segment.vector.SingleValueDimensionVectorSelector)4 Nullable (javax.annotation.Nullable)3 ColumnType (org.apache.druid.segment.column.ColumnType)3 ByteBuffer (java.nio.ByteBuffer)2 BufferAggregator (org.apache.druid.query.aggregation.BufferAggregator)2 TestLongColumnSelector (org.apache.druid.query.aggregation.TestLongColumnSelector)2 DimensionSpec (org.apache.druid.query.dimension.DimensionSpec)2 ValueMatcher (org.apache.druid.query.filter.ValueMatcher)2 RuntimeShapeInspector (org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector)2 IndexedInts (org.apache.druid.segment.data.IndexedInts)2 Predicate (com.google.common.base.Predicate)1