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

remove null assignments and check that the map is not empty check #479

Merged
merged 3 commits into from
Feb 4, 2025

Conversation

elliVM
Copy link
Contributor

@elliVM elliVM commented Jan 23, 2025

  • Check that map is not empty before iterating it
  • Remove the use of null

@elliVM elliVM linked an issue Jan 23, 2025 that may be closed by this pull request
@elliVM elliVM self-assigned this Jan 23, 2025
@elliVM elliVM requested a review from 51-code January 23, 2025 09:38
Copy link
Contributor

@51-code 51-code left a comment

Choose a reason for hiding this comment

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

I believe the logic has changed here somewhat. The map might be empty if there is no data found with the given query. The old version with the null might have let the query pass with an empty dataset, but the refactored version throws an exception. Letting the query through is probably the better option! Then the user would know that there was no data in the given time frame, because an empty dataset would be returned in the UI.

There is no test for this right now. There is one test for mode() in statsTransformationTest.java, but a test with an empty dataset could be added to see how it behaves currently as well as making sure that the logic doesn't change.

Copy link
Member

@kortemik kortemik left a comment

Choose a reason for hiding this comment

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

see change proposal by @51-code

@elliVM
Copy link
Contributor Author

elliVM commented Jan 28, 2025

made some changes that on an empty dataset result will be a empty column. Added test for empty dataset

@elliVM elliVM requested a review from 51-code January 28, 2025 10:59
Copy link
Contributor

@51-code 51-code left a comment

Choose a reason for hiding this comment

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

Now the solution for the mode aggregation looks really good, nice job. Left a comment about an import, maybe it was left behind after rewriting the test.

Copy link
Contributor

@51-code 51-code left a comment

Choose a reason for hiding this comment

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

Running spotless fixed the problem I commented on earlier. Approved!

@elliVM elliVM requested a review from kortemik January 29, 2025 06:40
@kortemik kortemik merged commit 6f170af into teragrep:main Feb 4, 2025
1 check passed
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.

Fix calling a method on null object in ModeBuffer.java class
4 participants