Skip to content

Support equality of StructArray #5199

@my-vegetable-has-exploded

Description

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)?

Metadata

Metadata

Labels

enhancementAny new improvement worthy of a entry in the changelog

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions