jayzhan211 commented on code in PR #5423:
URL: https://github.com/apache/arrow-rs/pull/5423#discussion_r1501308440
##########
arrow-ord/src/cmp.rs:
##########
@@ -198,7 +198,38 @@ fn compare_op(op: Op, lhs: &dyn Datum, rhs: &dyn Datum) ->
Result<BooleanArray,
let r = r_v.map(|x| x.values().as_ref()).unwrap_or(r);
let r_t = r.data_type();
- if l_t != r_t || l_t.is_nested() {
+ if l_t != r_t {
+ return Err(ArrowError::InvalidArgumentError(format!(
+ "Invalid comparison operation: {l_t} {op} {r_t}"
+ )));
+ }
+
+ if let Struct(_) = l_t {
+ let l = l.as_struct();
+ let r = r.as_struct();
+ assert_eq!(l.num_columns(), r.num_columns());
+ match op {
+ Op::Equal => {
+ let mut res = 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)?;
+ for (j, item) in res.iter_mut().enumerate().take(len) {
Review Comment:
clippy told me to use try_fold instead, but it is so difficult to work with
try_fold.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]