Skip to content

[BUG] median columns publish a truncating rolling mean, not a median #2140

Description

@amahussein

Describe the bug

The median column in stage_level_all_metrics.csv and sql_plan_metrics_for_application.csv is a rolling mean recomputed with integer division per task, so it ratchets toward the floor.

AccumInfo.addAccumToTask maintains StatisticsMetrics.med as (med * count + value) / (count + 1) on every task update, and the source already carries a TODO: update nomenclature from med to rolling average. There are two defects: the value is wrong, because integer division is applied once per task rather than once at the end, so the error compounds; and the name is wrong, because the column is published as median but holds a mean. Every accumulable goes through this path, so CPU-only event logs are affected as well as GPU ones.

Steps/Code to reproduce bug

Run the profiling tool on any event log and open stage_level_all_metrics.csv. Compare the median column against total divided by the stage task count for the same accumulator. On a CPU log from the repository test resources, internal.metrics.executorRunTime reports a median of 1 against a total of 707112.

Expected behavior

The column should report the quantity its name claims. Correcting the arithmetic alone yields an accurate mean still published as median, which is arguably worse than a visibly broken number, so this needs a decision rather than a patch. Either rename the column to mean and compute it as total / count, matching what the GPU aggregation columns now do, which is cheap but renames a shipped column; or keep the name and compute a true median, which requires retaining per-task values.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

? - Needs Triageapi_changeA change affecting the output (add/remove/rename files, add/remove/rename columns)bugSomething isn't workingcore_toolsScope the core module (scala)

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions