class CoreFunctionQueryParamBuilder implements QueryParamBuilder<Object> {

    @Override
    public Object build() {
        if (filterParams.length == 0 || filterParams.length <= index) {
            return null;
        }
        QueryParam param = filterParams[index];
        index++;
        if ("group".equalsIgnoreCase(param.getOperator())) {
            // if operator is group consider it as group functions
            if (param.getValue().size() > 1) {
                return new GroupColumnFilter(param.getColumn(), (String)param.getValue().get(0), (String)param.getValue().get(1), (Integer)param.getValue().get(2));
            } else {
                return new GroupColumnFilter(param.getColumn(), (String)param.getValue().get(0), null, -1);
            }
        }

        ColumnFilter filter = buildExpressionColumnFilter(param);
        if (filter != null) {
            return filter;
        }

        // check aggregate functions
        AggregateFunctionType aggregationType = AggregateFunctionType.getByName(param.getOperator());
        
        if (aggregationType != null) {
            return new AggregateColumnFilter(aggregationType, param.getColumn(), (String)param.getValue().get(0));
        }

        return new ExtraColumnFilter(param.getColumn(), (String)param.getValue().get(0));
    }

    public  CoreFunctionQueryParamBuilder(QueryParam...filterParams);

}