tidb icon indicating copy to clipboard operation
tidb copied to clipboard

implement aggregate functions under the new framework

Open zz-jason opened this issue 8 years ago • 7 comments

This PR https://github.com/pingcap/tidb/pull/6852 introduced the new framework to execute aggregate functions. Now the rest work is to rewrite every aggregate function under this new framework. The aggregate functions need to rewrite are listed in executor/aggfuncs/builder.go, which are:

  • [x] COUNT @Xuanwo
  • [x] SUM @laidahe
  • [x] AVG @zz-jason #6951
  • [x] FIRSTROW @XuHuaiyu
  • [x] MAX @XuHuaiyu
  • [x] MIN @XuHuaiyu
  • [x] GROUP_CONCAT @XuHuaiyu
  • [x] BIT_OR @crazycs520
  • [x] BIT_XOR @XuHuaiyu
  • [x] BIT_AND @XuHuaiyu

To rewrite a function, take https://github.com/pingcap/tidb/pull/6951 as an example, you need to:

  1. implement the aggregate function in file executor/aggfuncs/func_xxx.go
  2. supplement the buildXXX() function for the corresponding aggregate function in executor/aggfuncs/builder.go
  3. put the implemented aggregate functions into the var code block in file executor/aggfuncs/aggfuncs.go for code navigation.

If you are going to rewrite one of the above aggregate functions, please firstly make a comment here to let other contributors know. Feel free to contribute :grin:

zz-jason avatar Jul 02 '18 03:07 zz-jason

I'm interested to rewrite COUNT and SUM function.

Xuanwo avatar Jul 03 '18 07:07 Xuanwo

Really thank you for your support. @Xuanwo To make this issue be finished as soon as possible, if possible, you may implement COUNT first, and continue to work on SUM after the above work finished if there is no one else who is working on SUM?

XuHuaiyu avatar Jul 03 '18 07:07 XuHuaiyu

@XuHuaiyu OK, I will implement COUNT first.

Xuanwo avatar Jul 03 '18 07:07 Xuanwo

I want to implement SUM.OK?

laidahe avatar Jul 11 '18 07:07 laidahe

@laidahe Sure, thanks for your participation!😁

zz-jason avatar Jul 11 '18 07:07 zz-jason

hi, @laidahe friendly ping ^_^ Any problem you've got these days? If you need any help, feel free to comment here.

XuHuaiyu avatar Jul 18 '18 02:07 XuHuaiyu

All the aggregate functions are implemented, close this issue now.

zz-jason avatar Aug 10 '18 05:08 zz-jason