perf: Allow running as streaming node on the streaming engine#343
Open
Oliver Borchert (borchero) wants to merge 5 commits into
Open
perf: Allow running as streaming node on the streaming engine#343Oliver Borchert (borchero) wants to merge 5 commits into
Oliver Borchert (borchero) wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to make dataframely’s Polars validation path compatible with Polars’ streaming engine by registering the Rust plugin expressions as element-wise and adjusting the “required validation” expression to avoid forcing in-memory execution.
Changes:
- Register plugin functions as element-wise to allow streaming execution (
is_elementwise=True). - Adjust the Rust
all_rules_requiredsuccess-path to return a scalar/broadcastable true mask (intended to be streaming-friendly). - Document streaming-engine behavior caveats for lazy validation (early abort and non-deterministic reported failure).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/polars_plugin/mod.rs |
Changes all_rules_required’s empty-failure return value construction to support element-wise/streaming execution. |
dataframely/_plugin.py |
Updates plugin registration flags and docstring for all_rules_required to reflect streaming/element-wise behavior. |
dataframely/schema.py |
Adds documentation warning about lazy validation behavior under the streaming engine. |
Comments suppressed due to low confidence (1)
dataframely/_plugin.py:82
- Docstring inconsistency: the function is now registered as
is_elementwise=Trueand described as broadcasting to input length, but theReturns:section still says “A scalar boolean expression.” Update the return description to reflect that this expression yields a boolean result per row (mask) (or is broadcast to the input length).
- It broadcasts the resulting boolean series to the length of the input. This allows
element-wise evaluation and making this a non-blocking operation on the streaming
engine.
Args:
rules: The rules to evaluate.
schema_name: The name of the schema being validated. This is used to produce
better error messages.
null_is_valid: Whether to treat null values as valid (i.e., `true`).
Returns:
A scalar boolean expression.
"""
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #343 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 56 56
Lines 3404 3427 +23
=========================================
+ Hits 3404 3427 +23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Motivation
I realized that, when running on the streaming engine, our current Rust plugin forces in-memory execution. In some simple benchmarks, this also improves execution speed on the streaming engine 10-20%. I did not measure memory consumption but would expect a significant drop.
Example plan prior to this PR
Same plan after this PR