presto-main/src/main/java/io/prestosql/operator/aggregation/AggregationUtils.java/AggregationUtils/mergeCorrelationState
class AggregationUtils:    public static void mergeCorrelationState(CorrelationState state, CorrelationState otherState)
    {
        if (otherState.getCount() == 0) {
            return;
        }

        long na = state.getCount();
        long nb = otherState.getCount();
        state.setM2X(state.getM2X() + otherState.getM2X() + na * nb * Math.pow(state.getMeanX() - otherState.getMeanX(), 2) / (double) (na + nb));
        state.setM2Y(state.getM2Y() + otherState.getM2Y() + na * nb * Math.pow(state.getMeanY() - otherState.getMeanY(), 2) / (double) (na + nb));
        updateCovarianceState(state, otherState);
    }