@Override
    protected Object execute(Object[] obj, State state) {
        if (returnType == Attribute.Type.DOUBLE) {
            double total = 0;
            for (Object aObj : obj) {
                total += Double.parseDouble(String.valueOf(aObj));
            }

            return total;
        } else {
            long total = 0;
            for (Object aObj : obj) {
                total += Long.parseLong(String.valueOf(aObj));
            }
            return total;
        }

    }
Return type of the custom function mentioned

@return return type
modules/siddhi-core/src/test/java/io/siddhi/core/query/extension/util/CustomFunctionExtension.java