Search in sources :

Example 1 with GroupByColumnSelectorPlus

use of org.apache.druid.query.groupby.epinephelinae.column.GroupByColumnSelectorPlus in project druid by druid-io.

the class GroupByQueryEngineV2 method processNonVectorized.

private static Sequence<ResultRow> processNonVectorized(final GroupByQuery query, final StorageAdapter storageAdapter, final ByteBuffer processingBuffer, @Nullable final DateTime fudgeTimestamp, final GroupByQueryConfig querySpecificConfig, @Nullable final Filter filter, final Interval interval) {
    final Sequence<Cursor> cursors = storageAdapter.makeCursors(filter, interval, query.getVirtualColumns(), query.getGranularity(), false, null);
    return cursors.flatMap(cursor -> new BaseSequence<>(new BaseSequence.IteratorMaker<ResultRow, GroupByEngineIterator<?>>() {

        @Override
        public GroupByEngineIterator make() {
            final ColumnSelectorFactory columnSelectorFactory = cursor.getColumnSelectorFactory();
            final ColumnSelectorPlus<GroupByColumnSelectorStrategy>[] selectorPlus = DimensionHandlerUtils.createColumnSelectorPluses(STRATEGY_FACTORY, query.getDimensions(), columnSelectorFactory);
            final GroupByColumnSelectorPlus[] dims = createGroupBySelectorPlus(selectorPlus, query.getResultRowDimensionStart());
            final int cardinalityForArrayAggregation = getCardinalityForArrayAggregation(querySpecificConfig, query, storageAdapter, processingBuffer);
            if (cardinalityForArrayAggregation >= 0) {
                return new ArrayAggregateIterator(query, querySpecificConfig, cursor, processingBuffer, fudgeTimestamp, dims, hasNoExplodingDimensions(columnSelectorFactory, query.getDimensions()), cardinalityForArrayAggregation);
            } else {
                return new HashAggregateIterator(query, querySpecificConfig, cursor, processingBuffer, fudgeTimestamp, dims, hasNoExplodingDimensions(columnSelectorFactory, query.getDimensions()));
            }
        }

        @Override
        public void cleanup(GroupByEngineIterator iterFromMake) {
            iterFromMake.close();
        }
    }));
}
Also used : GroupByColumnSelectorPlus(org.apache.druid.query.groupby.epinephelinae.column.GroupByColumnSelectorPlus) ColumnSelectorPlus(org.apache.druid.query.ColumnSelectorPlus) ColumnSelectorFactory(org.apache.druid.segment.ColumnSelectorFactory) Cursor(org.apache.druid.segment.Cursor) GroupByColumnSelectorPlus(org.apache.druid.query.groupby.epinephelinae.column.GroupByColumnSelectorPlus)

Example 2 with GroupByColumnSelectorPlus

use of org.apache.druid.query.groupby.epinephelinae.column.GroupByColumnSelectorPlus in project druid by druid-io.

the class GroupByQueryEngineV2 method createGroupBySelectorPlus.

private static GroupByColumnSelectorPlus[] createGroupBySelectorPlus(ColumnSelectorPlus<GroupByColumnSelectorStrategy>[] baseSelectorPlus, int dimensionStart) {
    GroupByColumnSelectorPlus[] retInfo = new GroupByColumnSelectorPlus[baseSelectorPlus.length];
    int curPos = 0;
    for (int i = 0; i < retInfo.length; i++) {
        retInfo[i] = new GroupByColumnSelectorPlus(baseSelectorPlus[i], curPos, dimensionStart + i);
        curPos += retInfo[i].getColumnSelectorStrategy().getGroupingKeySize();
    }
    return retInfo;
}
Also used : GroupByColumnSelectorPlus(org.apache.druid.query.groupby.epinephelinae.column.GroupByColumnSelectorPlus)

Aggregations

GroupByColumnSelectorPlus (org.apache.druid.query.groupby.epinephelinae.column.GroupByColumnSelectorPlus)2 ColumnSelectorPlus (org.apache.druid.query.ColumnSelectorPlus)1 ColumnSelectorFactory (org.apache.druid.segment.ColumnSelectorFactory)1 Cursor (org.apache.druid.segment.Cursor)1