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

fix: sum([invalid]) -> undefined #3849

Merged
merged 2 commits into from Dec 22, 2023
Merged

Conversation

nicolaskruchten
Copy link
Contributor

Updating the behaviour of sum per #3848

@nicolaskruchten nicolaskruchten changed the title sum([null]) -> null fix: sum([invalid]) -> undefined Dec 19, 2023
@nicolaskruchten
Copy link
Contributor Author

Drat, I was hoping the checks would run automatically :) OK I'll be less lazy and set things up locally!

@domoritz
Copy link
Member

I see CI runs. Screenshot 2023-12-19 at 21 39 58

@mattijn
Copy link
Contributor

mattijn commented Dec 19, 2023

I approved😀

@nicolaskruchten
Copy link
Contributor Author

Thank you! I'll fix up the tests and do some more checks a bit later :)

@nicolaskruchten nicolaskruchten marked this pull request as ready for review December 20, 2023 04:00
@nicolaskruchten nicolaskruchten requested a review from a team as a code owner December 20, 2023 04:00
@nicolaskruchten
Copy link
Contributor Author

All tests passing!

@@ -330,7 +330,7 @@ tape('Aggregate handles empty/invalid data', t => {
'exponential',
'exponentialb'
];
const res = [4, 3, 0, 0]; // higher indices 'undefined'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this change do? Does this sufficiently test the new behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way the test is written, it checks the output of each aggregator in the list above when fed invalid values. The first four aggregators in the list used to return ints, the rest return undefined. sum is the fourth in that list and it used to return 0 but now returns undefined, so all I had to do was delete that one entry in the res array, and now we assert that sum([NaN, null, undefined, '']) = undefined just like mean and min etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So yes, I believe this is a sufficient test, or at least it's an equivalently-sufficient one to all the other aggregtors :)

@nicolaskruchten
Copy link
Contributor Author

Is there anything else I can do to make us confident about merging this?

@domoritz domoritz merged commit 229c806 into vega:main Dec 22, 2023
4 checks passed
@domoritz
Copy link
Member

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants