@Override
    protected StateFactory<AggregatorState> init(ExpressionExecutor[] attributeExpressionExecutors,
                                                 ProcessingMode processingMode,
                                                 boolean outputExpectsExpiredEvents, ConfigReader configReader,
                                                 SiddhiQueryContext siddhiQueryContext) {
        if (attributeExpressionExecutors.length != 1) {
            throw new OperationNotSupportedException("unionSet aggregator has to have exactly 1 parameter, currently " +
                    attributeExpressionExecutors.length + " parameters provided");
        }
        if (attributeExpressionExecutors[0].getReturnType() != Attribute.Type.OBJECT) {
            throw new OperationNotSupportedException("Parameter passed to unionSet aggregator should be of type" +
                    " object but found: " + attributeExpressionExecutors[0].getReturnType());
        }
        return () -> new AggregatorState(processingMode, outputExpectsExpiredEvents);

    }
The initialization method for FunctionExecutor

@param attributeExpressionExecutors are the executors of each attributes in the function
@param processingMode               query processing mode
@param outputExpectsExpiredEvents   is expired events sent as output
@param configReader                 this hold the {@link CountAttributeAggregatorExecutor} configuration reader.
@param siddhiQueryContext           Siddhi query runtime context
modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/attribute/aggregator/UnionSetAttributeAggregatorExecutor.java