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: Wrong output column name in or and xor operations #18512

Merged
merged 4 commits into from
Sep 2, 2024

Conversation

barak1412
Copy link
Contributor

Fixes #18442.

I noticed also that the xor operation uses the or operation when dealing with single None column, wheras in multiple None values column, it takes the general path, which is xor operation:

fn bitxor(self, rhs: Self) -> Self::Output {
        match (self.len(), rhs.len()) {
            // make sure that we fall through if both are equal unit lengths
            // otherwise we stackoverflow
            (1, 1) => {},
            (1, _) => {
                return match self.get(0) {
                    Some(true) => {
                        let mut rhs = rhs.not();
                        rhs.rename(self.name().clone());
                        rhs
                    },
                    Some(false) => {
                        let mut rhs = rhs.clone();
                        rhs.rename(self.name().clone());
                        rhs
                    },
                    None => &self.new_from_index(0, rhs.len()) | rhs,
                };
            },
            (_, 1) => {
                return match rhs.get(0) {
                    Some(true) => self.not(),
                    Some(false) => self.clone(),
                    None => self | &rhs.new_from_index(0, self.len()),
                };
            },
            _ => {},
        }

        arity::binary(self, rhs, |l_arr, r_arr| {
            let validity = combine_validities_and(l_arr.validity(), r_arr.validity());
            let values = l_arr.values() ^ r_arr.values();
            BooleanArray::from_data_default(values, validity)
        })
    }

Is it intended?

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Sep 2, 2024
@ritchie46
Copy link
Member

Thanks! Can you add a python test as well?

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.86%. Comparing base (4dc90a9) to head (5624209).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18512      +/-   ##
==========================================
- Coverage   79.87%   79.86%   -0.02%     
==========================================
  Files        1501     1501              
  Lines      202032   202029       -3     
  Branches     2868     2868              
==========================================
- Hits       161370   161346      -24     
- Misses      40115    40136      +21     
  Partials      547      547              

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

@barak1412
Copy link
Contributor Author

@ritchie46

Sure, just added.

@ritchie46 ritchie46 merged commit 04b78f8 into pola-rs:main Sep 2, 2024
26 checks passed
@ritchie46
Copy link
Member

Cheers!

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

Successfully merging this pull request may close these issues.

Using | operator results in column name literal
2 participants