Skip to content

Comments

feat: Add contains_dtype() method for Schema#26661

Open
Kevin-Patyk wants to merge 2 commits intopola-rs:mainfrom
Kevin-Patyk:feat/add_schema_contains_dtype
Open

feat: Add contains_dtype() method for Schema#26661
Kevin-Patyk wants to merge 2 commits intopola-rs:mainfrom
Kevin-Patyk:feat/add_schema_contains_dtype

Conversation

@Kevin-Patyk
Copy link
Contributor

@Kevin-Patyk Kevin-Patyk commented Feb 22, 2026

This is an old one, but it resolves #10247.

  • It adds contains_dtype() to SchemaEx in polars-core/src/schema/mod.rs and a helper function DataType::contains_dtype() in polars-core/src/datatypes/dtype.rs.
  • It adds an identical method to to the class Schema(BaseSchema) on the Python side.
  • Also, included a new file, test_schema.py to test the functionality on the Python side.

The Python Schema class is a pure Python class (not a PyO3-bound #[pyclass]), so contains_dtype() was implemented directly in Python, reusing the existing unpack_dtypes() utility for the recursive case.

🤖 Claude Opus 4.6 was used to help me navigate the codebase.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Feb 22, 2026
@Kevin-Patyk Kevin-Patyk changed the title feat: Add contains_dtype() method for Schema in Rust & Python feat: Add contains_dtype() method for Schema Feb 22, 2026
@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.39%. Comparing base (74e50a9) to head (fa812f1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-core/src/datatypes/dtype.rs 0.00% 10 Missing ⚠️
crates/polars-core/src/schema/mod.rs 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26661      +/-   ##
==========================================
- Coverage   81.40%   81.39%   -0.02%     
==========================================
  Files        1794     1794              
  Lines      245190   245210      +20     
  Branches     3080     3081       +1     
==========================================
- Hits       199609   199591      -18     
- Misses      44795    44833      +38     
  Partials      786      786              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 python Related to Python Polars rust Related to Rust Polars

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement has_datatype for Schema

1 participant