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

fix(rust): get_dtype handles input node schema and CSE #16582

Merged
merged 2 commits into from
May 30, 2024

Conversation

wence-
Copy link
Collaborator

@wence- wence- commented May 29, 2024

Both Select and HStack need to augment the schema for get_dtype with the dtypes of the CSE expressions, and everyone should look at their input to determine the schema in which the expressions are evaluated.

Also plumb through Reduce to provide that information to the outside world.

@github-actions github-actions bot added fix Bug fix rust Related to Rust Polars labels May 29, 2024
Copy link

codecov bot commented May 29, 2024

Codecov Report

Attention: Patch coverage is 16.66667% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 81.49%. Comparing base (0eb8384) to head (001628f).
Report is 13 commits behind head on main.

Files Patch % Lines
py-polars/src/lazyframe/visitor/nodes.rs 0.00% 3 Missing ⚠️
py-polars/src/lazyframe/visit.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #16582    +/-   ##
========================================
  Coverage   81.49%   81.49%            
========================================
  Files        1414     1414            
  Lines      185561   185714   +153     
  Branches     2997     3008    +11     
========================================
+ Hits       151219   151345   +126     
- Misses      33826    33853    +27     
  Partials      516      516            

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

let schema = ir_node.schema(&lp_arena);
let schema = match ir_node {
// Select operates on the input schema
IR::Select { .. } => ir_node.input_schema(&lp_arena).unwrap(),
Copy link
Member

Choose a reason for hiding this comment

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

Everything operates on it's input schema? Shouldn't we take input_schema for all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah yes, I think you are right. I confused myself thinking through various scenarios.

Specifically, join had me worried because the left (right) keys have dtypes that depend on the schema context of the left (right) input, but the correct way to treat that is to ensure that the relevant input is "active" when asking for the dtypes of the relevant set of keys.

Pushed an update.

@wence- wence- force-pushed the wence/fix/cse-redux branch from 71728ec to 001628f Compare May 30, 2024 10:02
@wence- wence- changed the title fix(rust): get_dtype needs to look at input schema for Select fix(rust): get_dtype needs to look at input schema and handle CSE specially May 30, 2024
@wence- wence- changed the title fix(rust): get_dtype needs to look at input schema and handle CSE specially fix(rust): get_dtype handles input node schema and CSE May 30, 2024
@ritchie46 ritchie46 merged commit d7b4f72 into pola-rs:main May 30, 2024
20 checks passed
@wence- wence- deleted the wence/fix/cse-redux branch May 30, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants