use of com.actiontech.dble.plan.common.external.ResultStore in project dble by actiontech.
the class OrderedGroupByHandler method prepareSumAggregators.
/**
* see Sql_executor.cc
*
* @return
*/
protected void prepareSumAggregators(List<ItemSum> functions, List<ItemSum> sumFunctions, List<FieldPacket> packets, boolean isAllPushDown, boolean needDistinct, MySQLConnection conn) {
LOGGER.info("prepare_sum_aggregators");
for (int i = 0; i < functions.size(); i++) {
ItemSum func = functions.get(i);
ResultStore store = null;
if (func.hasWithDistinct()) {
ItemSum selFunc = sumFunctions.get(i);
List<Order> orders = HandlerTool.makeOrder(selFunc.arguments());
RowDataComparator distinctCmp = new RowDataComparator(packets, orders, isAllPushDown, this.type());
store = new DistinctLocalResult(pool, packets.size(), distinctCmp, this.charset).setMemSizeController(session.getOtherBufferMC());
distinctStores.add(store);
}
func.setAggregator(needDistinct && func.hasWithDistinct() ? AggregatorType.DISTINCT_AGGREGATOR : AggregatorType.SIMPLE_AGGREGATOR, store);
}
}
Aggregations