private PlannerOp planAggregate(EnumerableAggregate op, RelDataType rowType, boolean returnValues) { List<RelDataTypeField> fieldList = op.getRowType().getFieldList(); List<AggregateCall> calls = op.getAggCallList(); String[] fieldnames = new String[fieldList.size()]; String[] aggtypes = new String[calls.size()]; Column[] columns = new Column[fieldList.size()]; List<Integer> groupedFiledsIndexes = op.getGroupSet().toList(); List<List<Integer>> argLists = new ArrayList<>(calls.size()); int i = 0; int idaggcall = 0; for (RelDataTypeField c : fieldList) { int type = convertToHerdType(c.getType()); Column co = Column.column(c.getName(), type); columns[i] = co; fieldnames[i] = c.getName().toLowerCase(); i++; } for (AggregateCall call : calls) { aggtypes[idaggcall++] = call.getAggregation().getName(); argLists.add(call.getArgList()); } PlannerOp input = convertRelNode(op.getInput(), null, returnValues); return new AggregateOp(input, fieldnames, columns, aggtypes, argLists, groupedFiledsIndexes); }