@Override
    protected StateFactory init(AbstractDefinition inputDefinition,
                                ExpressionExecutor[] attributeExpressionExecutors,
                                ConfigReader configReader, boolean outputExpectsExpiredEvents,
                                SiddhiQueryContext siddhiQueryContext) {
        inputExecutorLength = attributeExpressionExecutors.length;

        if (inputExecutorLength < 2 || inputExecutorLength > 3) {
            throw new SiddhiAppValidationException("Input parameters for poleCart can either be 'theta,rho' or " +
                    "'theta,rho,z', but " +
                    attributeExpressionExecutors.length + " attributes found");
        }
        for (int i = 0; i < inputExecutorLength; i++) {
            ExpressionExecutor expressionExecutor = attributeExpressionExecutors[i];
            if (expressionExecutor.getReturnType() != Attribute.Type.DOUBLE) {
                throw new SiddhiAppValidationException("Input attribute " + i + " is expected to return Double, " +
                        "but its returning " + expressionExecutor.getReturnType());
            }

        }
        if (attributeExpressionExecutors.length == 2) {
            for (Attribute attribute : inputDefinition.getAttributeList()) {
                if (attribute.getName().equals("x") || attribute.getName().equals("y")) {
                    throw new SiddhiAppValidationException("Input stream " + inputDefinition.getId() + " should " +
                            "not contain attributes with name 'x' or 'y', but found " + attribute);
                }
            }
            retrunAttributes = Arrays.asList(
                    new Attribute("x", Attribute.Type.DOUBLE),
                    new Attribute("y", Attribute.Type.DOUBLE));
        } else {
            for (Attribute attribute : inputDefinition.getAttributeList()) {
                if (attribute.getName().equals("x") || attribute.getName().equals("y") || attribute.getName().equals
                        ("z")) {
                    throw new SiddhiAppValidationException("Input stream " + inputDefinition.getId() + " should " +
                            "not contain attributes with name 'x' or 'y' or 'z', but found " + attribute);
                }
            }
            retrunAttributes = Arrays.asList(
                    new Attribute("x", Attribute.Type.DOUBLE),
                    new Attribute("y", Attribute.Type.DOUBLE),
                    new Attribute("z", Attribute.Type.DOUBLE));
        }
        return null;
    }
The init method of the StreamFunction

@param inputDefinition              the incoming stream definition
@param attributeExpressionExecutors the executors for the function parameters
@param siddhiQueryContext           siddhi query context
@return the additional output attributes introduced by the function
modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/function/Pol2CartStreamFunctionProcessor.java