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

docs: Fix Rust examples in user guide #20075

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

lukemanley
Copy link
Contributor

Adds required features and fixes a few broken examples in the user guide.

@github-actions github-actions bot added documentation Improvements or additions to documentation python Related to Python Polars rust Related to Rust Polars labels Nov 30, 2024
@lukemanley lukemanley changed the title docs: Fix Rust examples docs: Fix Rust examples in user guide Nov 30, 2024
@@ -17,8 +17,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.clone()
.lazy()
.select([
(col("nrs") + lit(5)).alias("nrs + 5"),
(col("nrs") - lit(5)).alias("nrs - 5"),
(col("nrs") + lit(5).cast(DataType::Int32)).alias("nrs + 5"),
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be typed_lit, but what is the failure here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

without the cast, the error is:

SchemaMismatch: failed to determine supertype of i32 and dyn int

I may be wrong, but it doesn't look like typed_lit is exposed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually, the cast is not needed. This example required the dtype-i8 feature as materialize_smallest_dyn_int ends up converting to i8.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ritchie46 this is an issue I've encountered and luke's conclusion is correct/what you folks told me: that I needed the feature dtype-i8 but that something needed fixing because it wasn't supposed to require a feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ritchie46 this is an issue I've encountered and luke's conclusion is correct/what you folks told me: that I needed the feature dtype-i8 but that something needed fixing because it wasn't supposed to require a feature.

I opened #20108 which adds a feature gate around i8/i16 (u8/u16) in order to allow this example to run without additional features.

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.52%. Comparing base (1f104f9) to head (bdffec6).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20075      +/-   ##
==========================================
- Coverage   79.53%   79.52%   -0.01%     
==========================================
  Files        1563     1563              
  Lines      217124   217124              
  Branches     2464     2464              
==========================================
- Hits       172680   172678       -2     
- Misses      43884    43886       +2     
  Partials      560      560              

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants