Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Fixes for four issues, one commit per issue.
mean()of an empty iterable, or an empty row of a nested one, returnsnaninstead of0.0, as a node state already does.mean()on iterables and node states adds up inf64, so a large integer total no longer wraps to a negative mean.sum()still wraps on overflow, as numpy's integersum()does, and its docstring now says so.groups()returns its groups in the order of their first node, with each group's nodes in node order, so a group index names the same group on every call. GraphQL'sgroupBygets the same order.min,max,median,top_k,bottom_kand the_itemforms leave missing values out, andsorted()puts them last.min()returnsNoneonly when no value is present.Why are the changes needed?
Each one gave a wrong result without an error: a mean of
0.0for no input, a negative mean for large timestamps, a group index that changed meaning between calls, andNoneas the minimum of a state that has values.Does this PR introduce any user-facing change? If yes is this documented?
Yes, all four. The docstrings and stubs describe the new behaviour.
OptionalOrderedNodeStateOps, used by the Python classes whose values may be missing. It is not in the prelude, becauseOptionvalues are alsoOrdand the two traits would make.min()ambiguous. So Rust callers ofOrderedNodeStateOpsonOptionstates keep the old order unless they use the new trait.How was this patch tested?
i64::MAXvalues and of an empty state (the first fails without the fix), and a Python test with update times near2**62.groups()give the same groups in the same order.node_type, and on an optional and a doubly optional list.sorted()in both directions.raphtory-tests,raphtory-graphqland base Python suites pass, andmypy -m raphtoryis clean on the regenerated stubs.