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

feat(rust): Pub-licize Expr DSL Function enums #20421

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

Shoeboxam
Copy link
Contributor

Changes the visibility of parts of the Expr DSL that I'd like to add support for in OpenDP (see current docs) to pub.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature rust Related to Rust Polars labels Dec 23, 2024
@ritchie46
Copy link
Member

They are not meant to be public. They are internal state of the DSL. Could you explain why you need that public?

Copy link

codecov bot commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.92%. Comparing base (de1d9d5) to head (f4511de).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20421      +/-   ##
==========================================
+ Coverage   79.85%   79.92%   +0.07%     
==========================================
  Files        1596     1596              
  Lines      228642   228642              
  Branches     2615     2615              
==========================================
+ Hits       182571   182733     +162     
+ Misses      45473    45311     -162     
  Partials      598      598              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Shoeboxam
Copy link
Contributor Author

Shoeboxam commented Dec 23, 2024

The use-case is a software project (OpenDP) that proves that a given Polars DSLPlan satisfies differential privacy. For an example of its use, the Switzerland Federal Statistical Office used the tool to release high-resolution poverty statistics.

To accomplish this, I've written a number of Polars plugins, as well as a static analyzer for DSLPlans. The analyzer tracks key properties about the data via a recursive parser over each expression/step in the DSLPlan. Over the last year I've been expanding the kinds of expressions and plans that the analyzer can reason about.

For example, if an expression in the plan contains an ArrayFunction::Explode, then in differential privacy jargon the analyzer needs to account for a k-stable transformation (where k is the static array length). Whereas if the DSLPlan contains an ArrayFunction::Min, then the analyzer needs to account for a 1-stable transformation. Unfortunately, since the array enum is private, I can't add logic to the analyzer for array functions, so the analyzer rejects all Polars plans with array functions.

For more context on the project:

@Shoeboxam
Copy link
Contributor Author

Based on my use-case, is this something you would be open to adding to the public API? Thanks.

@ritchie46
Copy link
Member

Right, though I do want to warn that we don't guarantee stability on this yet. I first want to get the DSL out into a seperate crate and version that properly.

Anyhow can you rebase?

@ritchie46
Copy link
Member

@Shoeboxam can you rebase?

@Shoeboxam
Copy link
Contributor Author

Right, though I do want to warn that we don't guarantee stability on this yet. I first want to get the DSL out into a seperate crate and version that properly.

Don't worry, I don't expect API stability. I've been making quarterly releases on my side that brings OpenDP in-line with the latest version of Polars that has DSL compatibility between the Rust and Python crate.

Occasionally the Python and Rust DSLs can drift apart due to patch releases with DSL changes, making a monthly Rust release non-viable, in which case I downgrade until finding a matching pair.

Anyhow can you rebase?

Done! Thanks for the response.

@ritchie46
Copy link
Member

Yeah, I hope we can get to a typed DSL soon.

@ritchie46 ritchie46 merged commit 2608dbf into pola-rs:main Feb 19, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants