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();
}
}));
}
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;
}
Aggregations