Skip to content

docs: MEDIAN_TDIGEST is a distinct registered function but is undocumented — not mentioned as alias in QUANTILE_TDIGEST docs #3299

@sundy-li

Description

@sundy-li

What's Missing

MEDIAN_TDIGEST is registered as a separate aggregate function in the Databend source code, but it has no documentation page and is not mentioned as an alias in the existing QUANTILE_TDIGEST documentation.

Source File

/workspace/databend/src/query/functions/src/aggregates/aggregate_quantile_tdigest.rs

Relevant registration in /workspace/databend/src/query/functions/src/aggregates/aggregator.rs:

factory.register("quantile_tdigest", aggregate_quantile_tdigest_function_desc());
factory.register("median_tdigest", aggregate_median_tdigest_function_desc());

Both aggregate_quantile_tdigest_function_desc() and aggregate_median_tdigest_function_desc() are defined in aggregate_quantile_tdigest.rs. They use the same underlying implementation but with different type constants (QUANTILE vs MEDIAN), meaning MEDIAN_TDIGEST is a fixed-level (0.5) variant of QUANTILE_TDIGEST.

What It Does

MEDIAN_TDIGEST(<expr>) computes the median (50th percentile) of a numeric data sequence using the t-digest algorithm. It is equivalent to QUANTILE_TDIGEST(0.5)(<expr>) but takes no level parameter.

Current State of Docs

The existing doc at /docs/en/sql-reference/20-sql-functions/07-aggregate-functions/aggregate-quantile-tdigest.md documents QUANTILE_TDIGEST but does not mention MEDIAN_TDIGEST as an alias or related function.

The aggregate-median-tdigest.md doc exists and documents MEDIAN_TDIGEST as a standalone function, but does not cross-reference QUANTILE_TDIGEST or explain the relationship.

What Needs to Be Fixed

  1. Add an Aliases section to aggregate-quantile-tdigest.md listing MEDIAN_TDIGEST (when called with level 0.5).
  2. Add a cross-reference in aggregate-median-tdigest.md pointing to QUANTILE_TDIGEST.

Suggested Doc Location

  • /docs/en/sql-reference/20-sql-functions/07-aggregate-functions/aggregate-quantile-tdigest.md — add alias reference
  • /docs/en/sql-reference/20-sql-functions/07-aggregate-functions/aggregate-median-tdigest.md — add cross-reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions