confluentinc / confluentinc/ksql
avg should return null when no row is aggregated
- Dominant language
- Java
- Stars
- 315
- Forks
- 1k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 36
Description
**Is your feature request related to a problem? Please describe.**
[avg](https://docs.ksqldb.io/en/latest/developer-guide/ksqldb-reference/aggregate-functions/#avg) returns `0.0` instead of `NULL` when no row is aggregated. However, IMHO, `NULL` is preferable because `0.0` means nothing. In addition, other projects like apache spark return null in this case. What do you think?
**Describe the solution you'd like**
[avg](https://docs.ksqldb.io/en/latest/developer-guide/ksqldb-reference/aggregate-functions/#avg) should return null when no row is aggregated.
**Describe alternatives you've considered**
**Additional context**
Contributor guide
Research direction
Start with the avg aggregate-function documentation linked in the issue and trace the corresponding implementation and tests in the ksql repository. Confirm the behavior when no rows are aggregated, then update the relevant coverage so the result is NULL rather than 0.0 and verify the aggregate-function tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- databases, stream-processing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100