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

eq for struct #5423

Closed
wants to merge 8 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions arrow-ord/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,19 @@ fn compare_op(op: Op, lhs: &dyn Datum, rhs: &dyn Datum) -> Result<BooleanArray,
assert_eq!(l.num_columns(), r.num_columns());
match op {
Op::Equal => {
let mut res = BooleanArray::from(vec![true; len]);
for i in 0..l.num_columns() {
let col_l = l.column(i);
let col_r = r.column(i);
let eq_rows = compare_op(op, col_l, col_r)?;

let nulls = NullBuffer::union(res.nulls(), eq_rows.nulls());
let vals = res.values() & eq_rows.values();
res = BooleanArray::new(vals, nulls);
}
return Ok(res);
return (0..l.num_columns()).fold(
Ok(BooleanArray::from(vec![true; len])),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Ok(BooleanArray::from(vec![true; len])),
Ok(BooleanArray::new(BooleanBuffer::new_set(len), None)),

This will be significantly faster

|res, i| {
let res = res?;
let col_l = l.column(i);
let col_r = r.column(i);
let eq_rows = compare_op(op, col_l, col_r)?;

let nulls = NullBuffer::union(res.nulls(), eq_rows.nulls());
let vals = res.values() & eq_rows.values();
Ok(BooleanArray::new(vals, nulls))
},
)
}
_ => {
return Err(ArrowError::NotYetImplemented(format!(
Expand Down
Loading