zhouqingqing / qpmodel

A Relational Optimizer and Executor
MIT License
64 stars 18 forks source link

fix average aggregate (issue #181) #182

Closed arzuschen closed 3 years ago

arzuschen commented 3 years ago

fix for issue #181 Previously, avg() clause with aggregate will result in same average among different groups. This is caused by pair attribute within AggAvg class being falsely reused for accumulation. This will lead to wrong answer as well as same value across different groups. All the other aggregate functions do to encounter this error because the old values are passed into the recorded data. Thus the corresponding data record (pair for AggAvg) is updated every time the accumulation method is called. Unit test expected result is changed accordingly. In fact, only tpch q01 need to be changed.