ClickHouse / ch-go

Low-level Go Client for ClickHouse
Apache License 2.0
325 stars 51 forks source link

Support for AggregateFunction data type #372

Open srikanthccv opened 9 months ago

srikanthccv commented 9 months ago

This is a parent issue to add support for the data type AggregateFunction. Several different categories of quantile functions can be used with AggregateFunction. I think each of them deserves their own type as they have custom serialization/deserialization. I would like to help with this effort starting with quantile(s)DDSketch and quantileBFloat16 and more to follow. I have a quick prototype for DDSketch here https://github.com/ClickHouse/ch-go/compare/main...srikanthccv:ch-go:ddsketch.

@ernado do you have anything in mind how the API should look like?

### Tasks
- [ ] Add support for uniq AggregateFunction
- [ ] Add support for anyIf AggregateFunction
- [ ] Add support for quantiles AggregateFunction
- [ ] Add support for quantilesDeterministic AggregateFunction
- [ ] Add support for quantilesTiming(Weighted) AggregateFunction
- [ ] Add support for quantilesExact(Weighted) AggregateFunction
- [ ] Add support for quantilesTDigest AggregateFunction
- [ ] Add support for quantilesBFloat16 AggregateFunction
- [ ] Add support for quantilesDDSketch AggregateFunction
srikanthccv commented 9 months ago

The encode and decode parts should be fairly straightforward from the serialize and deserialize methods from ClickHouse. One thing that I am not sure what is the best way to go about it is ColumnType because it can vary a lot but that doesn't really matter at all because the underlying state decode and encode dictate everything.