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

Support equality of StructArray #5199

Closed
my-vegetable-has-exploded opened this issue Dec 11, 2023 · 5 comments · Fixed by #5792
Closed

Support equality of StructArray #5199

my-vegetable-has-exploded opened this issue Dec 11, 2023 · 5 comments · Fixed by #5792
Assignees
Labels
enhancement Any new improvement worthy of a entry in the changelog

Comments

@my-vegetable-has-exploded
Copy link
Contributor

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

In datafusion #6635, we think convert tuple to struct will be helpful to implement multi column In list.

But StructAray is not comparable in arrow-rs since it is nested.

if l_t != r_t || l_t.is_nested() {
return Err(ArrowError::InvalidArgumentError(format!(
"Invalid comparison operation: {l_t} {op} {r_t}"
)));
}
.

Describe the solution you'd like

I don't know if this feature is already implemented in arrow.

In my view, compare PrimitiveArray may be rather different from NestedArray. Take equality of StrutArray as an example, I think it may need those steps:

  • check equality of datatype
  • check equality of PrimitiveArray for each field
  • perform conjunction operation on the results of each field

The process slightly differs from the apply_op process.

for bit_idx in 0..64 {
let i = bit_idx + chunk * 64;
packed |= (f(i) as u64) << bit_idx;
}

Describe alternatives you've considered

Additional context

The equality of other array type may need more further consideration. Like equality for ListArray, shall we considerate out of order between list(which means that whether [[1,2]] and [[2,1]] are equal or not)?

@my-vegetable-has-exploded my-vegetable-has-exploded added the enhancement Any new improvement worthy of a entry in the changelog label Dec 11, 2023
@alamb
Copy link
Contributor

alamb commented Dec 11, 2023

@tustvold do you know if there any fundamental reason we can't compare struct arrays for equality (by recursively checking each field)?

@tustvold
Copy link
Contributor

Not that I am aware of, should be fairly straightfoward

@my-vegetable-has-exploded
Copy link
Contributor Author

Thanks for the reply. If this enhancement is not so urgent, I am willing to submit a pr later.

@tustvold
Copy link
Contributor

I don't believe there is any particular urgency on this one, thank you

@Dandandan Dandandan changed the title Support equality of StrutArray Support equality of StructArray Dec 12, 2023
@alamb
Copy link
Contributor

alamb commented Dec 12, 2023

I agree there is no urgency from my perspective

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
3 participants