[DRUID 29] doubleMean aggregation function behavior

29 views
Skip to first unread message

Vicent Taylor

unread,
Dec 26, 2024, 11:16:51 PM12/26/24
to Druid User
When doubleMean aggregate with no data selected, it returns 0. For other aggregation like doubleMax, doubleMin and doubleSum, it returns null.

The later behavior is more aligned to SQL. Could we improve this behavior?

{
  "queryType": "groupBy",
  "aggregations": [
    {
      "type": "filtered",
      "aggregator": {
        "type": "doubleMean",
        "name": "_agg",
        "fieldName": "metric_value"
      },
      "filter": {
        "type": "expression",
        "expression": " 0 "
      }
    }
  ],
  "dataSource": {
    "type": "inline",
    "columnNames": ["metric_name", "metric_value"],
    "columnTypes": ["STRING", "LONG"],
    "rows": [
      ["test", 1],
      ["test", 2],
      ["test", 3],
      ["test", 4],
      ["test", 5]
    ]
  },
  "intervals": [
    "-10000/10000"
  ],
  "granularity": "all",
  "dimensions": [
    "metric_name"
  ],
  "having": {
    "type": "always"
  }
}

Vicent Taylor

unread,
Dec 27, 2024, 1:36:36 AM12/27/24
to druid...@googlegroups.com
The function array_quantile return DOUBLE NaN instead of null when the array is empty. This behavior may also need to be improved.
array_quantile(array(null),0.5)

--
You received this message because you are subscribed to a topic in the Google Groups "Druid User" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/druid-user/UoKvhuTJ0cs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to druid-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/druid-user/27183369-7443-4a33-9422-bbba08fefa7an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages