Skip to content

Fix 4 defects: mean of empty or large inputs, stable groups, and missing values in orderings - #2966

Open
shivamka1 wants to merge 6 commits into
db_v4from
fix/defects-batch-3c
Open

shivamka1 wants to merge 6 commits into
db_v4from
fix/defects-batch-3c

Conversation

@shivamka1

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Fixes for four issues, one commit per issue.

Issue Fix
#413 mean() of an empty iterable, or an empty row of a nested one, returns nan instead of 0.0, as a node state already does.
#409 mean() on iterables and node states adds up in f64, so a large integer total no longer wraps to a negative mean. sum() still wraps on overflow, as numpy's integer sum() does, and its docstring now says so.
#410 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's groupBy gets the same order.
#406 On node states and iterables whose values may be missing, min, max, median, top_k, bottom_k and the _item forms leave missing values out, and sorted() puts them last. min() returns None only when no value is present.

Why are the changes needed?

Each one gave a wrong result without an error: a mean of 0.0 for no input, a negative mean for large timestamps, a group index that changed meaning between calls, and None as 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.

  • Python: as in the table above.
  • Rust: Fix and test stopping of deployment #406 adds OptionalOrderedNodeStateOps, used by the Python classes whose values may be missing. It is not in the prelude, because Option values are also Ord and the two traits would make .min() ambiguous. So Rust callers of OrderedNodeStateOps on Option states keep the old order unless they use the new trait.

How was this patch tested?

  • Dev 943 / Sink API #413: a Python test of an empty list, an empty node state and an empty row.
  • Thread-safe watermarking #409: Rust tests of a node state of three i64::MAX values and of an empty state (the first fails without the fix), and a Python test with update times near 2**62.
  • Changing sbt path and change nightly tag functionality #410: a Python test that 20 calls of groups() give the same groups in the same order.
  • Fix and test stopping of deployment #406:
    • The issue's examples as Python tests, on a lazy and a computed node state, on node_type, and on an optional and a doubly optional list.
    • sorted() in both directions.
    • A state with no values.
  • The full raphtory-tests, raphtory-graphql and base Python suites pass, and mypy -m raphtory is clean on the regenerated stubs.

This branch has not been deployed

No deployments
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.

1 participant