vega / vega

A visualization grammar.

Home Page:https://vega.github.io/vega

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposal for new `sumnull` aggregation

nicolaskruchten opened this issue · comments

Today, the Vega sum aggregation returns 0 if its inputs are all null, whereas the average operator returns null. As a result, simple line charts which might be expected to be equivalent look quite different, with the sum line going to zero and the average line being interrupted:

CleanShot 2023-12-19 at 10 32 38@2x

Spec in Editor

A number of stakeholders of our application would like to be able to have the ability to have sum behave like average in cases like these, and while I can imagine there is very little appetite for changing the behaviour of sum in Vega, I'd like to propose the addition of a new aggregation sumnull which would behave the same as sum but return null when its inputs are all all null or otherwise invalid.

Would the Vega team accept a pull request for such a feature?

Hmm, I wonder what the reason for the different behavior was. Pinging @jheer @arvind

Maybe it would make more sense to update the existing sum to have more SQL-like semantics. I don’t think we had any principled reasons for the current behavior.

Great. I like consistency. @nicolaskruchten do you want to send a pull request and check for any regressions? We can argue that the previous behavior was a bug or at the very least undefined.