GSoC Part 2 - Construct Regression functions in queries with GROUP BY
Overview
In this part, I finished the design of regression function, and implemented most part of them. Basically, the implementation of window can be completed at the same, but the tests still need to be verified.
The core part of these functions is how to accumulate the value instead of calculating at the end of process. I adopted the Welford’s online algorithm and implement it in Regr_result class. Then all of Item_sum_regr_XXX will use it to get the value by invoking individual bool val_real(). The following UML figure shows the architecture.
It is worth noting that the aggregation function with GROUP BY used the Item_regr_XXX_field to store the value. While the aggregation without GROUP BY used the Aggregator class to iterate each row.