docs: missing documentation for SUM0 / SUM_ZERO aggregate function

Open Beginner friendly
#3,193 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Quiet
Tech stack
sql
Domain
documentation

Research direction

Start with src/query/functions/src/aggregates/aggregator.rs and src/query/functions/src/aggregates/aggregate_sum_zero.rs to confirm the function name, alias, input type, and NULL behavior. Add the documented page at docs/en/sql-reference/20-sql-functions/07-aggregate-functions/aggregate-sum0.md, including the provided empty-input example; it is done when SUM0 and SUM_ZERO are covered consistently with nearby aggregate-function pages.

Written by the indexing model from the issue text.

Description

documentation

Missing Documentation: SUM0 / SUM_ZERO

What is missing

The SUM0 and SUM_ZERO aggregate functions are registered in the Databend function registry but have no documentation in databend-docs.

Source code
  • Registration: /workspace/databend/src/query/functions/src/aggregates/aggregator.rs (lines 76–77)
  • Implementation: src/query/functions/src/aggregates/aggregate_sum_zero.rs
What it does

SUM0 (alias: SUM_ZERO) is an aggregate function that sums UInt64 values. Unlike the standard SUM, it returns 0 instead of NULL when all input values are NULL or the group is empty. This is useful in scenarios where a zero result is semantically meaningful (e.g., counting absent events).

-- Returns 0 when there are no rows, instead of NULL
SELECT sum0(val) FROM t WHERE false;
-- ┌──────────┐
-- │ sum0(val)│
-- ├──────────┤
-- │        0 │
-- └──────────┘
Suggested doc location

docs/en/sql-reference/20-sql-functions/07-aggregate-functions/aggregate-sum0.md

Dominant language
TypeScript
Stars
17
Forks
44
Avg merge
2d 7m
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from databendlabs/databend-docs

All issues in databendlabs/databend-docs

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.