use of com.huawei.boostkit.omnidata.decode.type.LongDecodeType in project boostkit-bigdata by kunpengcompute.
the class DataIoAdapter method extractAggregateFunction.
private void extractAggregateFunction(AggregateFunction aggregateFunction, Map<String, AggregationInfo.AggregateFunction> aggregationMap) {
List<Expression> expressions = JavaConverters.seqAsJavaList(aggregateFunction.children());
String aggregateFunctionName = aggregateFunction.toString();
Type prestoType = NdpUtils.transOlkDataType(aggregateFunction.dataType(), false);
AggregateFunctionType aggregateFunctionType = AggregateFunctionType.valueOf(aggregateFunction.getClass().getSimpleName());
for (Expression expression : expressions) {
if (!(expression instanceof Literal)) {
omnidataProjections.add(createAggProjection(expression));
int projectionId = fieldMap.size();
fieldMap.put(aggregateFunctionName, projectionId);
if (aggregateFunctionType.equals(AggregateFunctionType.Count)) {
prestoType = NdpUtils.transOlkDataType(expression.dataType(), false);
}
omnidataTypes.add(prestoType);
break;
}
}
columnOrdersList.add(columnOrder++);
switch(aggregateFunctionType) {
case Sum:
case Max:
case Min:
extractSumMaxMinAggregation(prestoType, aggregateFunctionName, aggregationMap);
break;
case Average:
columnTypesList.add(new RowDecodeType());
columnOrdersList.add(columnOrder++);
extractAvgAggregation(prestoType, aggregateFunctionName, aggregationMap);
break;
case Count:
columnTypesList.add(new LongDecodeType());
extractCountAggregation(prestoType, aggregateFunctionName, aggregationMap);
break;
}
}
Aggregations