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

Add boolean equality and inequality kernels #842

Closed
alamb opened this issue Oct 21, 2021 · 4 comments · Fixed by #844
Closed

Add boolean equality and inequality kernels #842

alamb opened this issue Oct 21, 2021 · 4 comments · Fixed by #844
Assignees
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented Oct 21, 2021

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

I am trying to compare two boolean arrays (see DataFusion PR apache/datafusion#1163) and produce another BooleanArray

There are a variety of kernels in arrow that support comparing primitive (numeric) arrays and string arrays such as eq, eq_utf8 eq_scalar, etc.

https://docs.rs/arrow/6.0.0/arrow/compute/kernels/comparison/index.html

Describe the solution you'd like

I would like the following four kernels in arrow (see implementations in apache/datafusion#1163)

// return a new BooleanArray which is the result of comparing left and right element by element
fn eq_bool(left: &BooleanArray, right: &BooleanArray) -> result<BooleanArray> {
  ..
}
// return a new BooleanArray which is the result of comparing left and right element by element
fn neq_bool(left: &BooleanArray, right: &BooleanArray) -> result<BooleanArray> {
  ..
}
// return a new BooleanArray which is the result of comparing left and right element by element
fn eq_bool_scalar(left: &BooleanArray, right: bool) -> result<BooleanArray> {
  ..
}
// return a new BooleanArray which is the result of comparing left and right element by element
fn neq_bool_scalar(left: &BooleanArray, right: bool) -> result<BooleanArray> {
  ..
}
@alamb alamb added good first issue Good for newcomers enhancement Any new improvement worthy of a entry in the changelog arrow Changes to the arrow crate labels Oct 21, 2021
@Dandandan
Copy link
Contributor

Seems to me we can/should implement this with bitwise operations, i.e. !(x ^ y)

@Dandandan
Copy link
Contributor

Let me have a go at this

@Dandandan Dandandan self-assigned this Oct 21, 2021
@alamb
Copy link
Contributor Author

alamb commented Oct 21, 2021

Seems to me we can/should implement this with bitwise operations, i.e. !(x ^ y)

I assume you mean calculate more than one element of each array at a time (like do it 8 or 64 bits at a time):

@Dandandan
Copy link
Contributor

Seems to me we can/should implement this with bitwise operations, i.e. !(x ^ y)

I assume you mean calculate more than one element of each array at a time (like do it 8 or 64 bits at a time):

Yes, that was the idea (u64 at a time). See the PR for the implementation :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants