Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Median_avg and quantile_avg ignore NULL values #6807

monetdb-team opened this issue Nov 30, 2020 · 0 comments

Median_avg and quantile_avg ignore NULL values #6807

monetdb-team opened this issue Nov 30, 2020 · 0 comments


Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2020-01-10 09:07:03 +0100
From: @PedroTadim
To: SQL devs <>
Version: 11.35.9 (Nov2019-SP1)

Last updated: 2020-02-21 12:36:58 +0100

Comment 27508

Date: 2020-01-10 09:07:03 +0100
From: @PedroTadim

User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
Build Identifier:

If median_avg or the quantile_avg of a group is going to be computed as the average of two values, if one of them is NULL, then the value is ignored, while it shouldn't.

Reproducible: Always

Steps to Reproduce:

  1. SELECT median_avg(c1) FROM (VALUES (1), (NULL)) t1(c1);

Actual Results:


Expected Results:


Comment 27509

Date: 2020-01-10 09:50:00 +0100
From: MonetDB Mercurial Repository <>

Changeset 14395b0ea40e made by Pedro Ferreira in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=14395b0ea40e

Changeset description:

Added test and fix for bug #6807, ie look for NULL values while computing quantile_avg

Comment 27510

Date: 2020-01-10 11:33:12 +0100
From: @sjoerdmullender

Is this the correct thing to do?
Shouldn't NULL be ignored when calculating the median/quantile?
This would mean that the result is only NULL if all values are NULL, not if any is NULL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant