Skip to content

Commit

Permalink
Improve error message for unsupported nested comparison (#5961)
Browse files Browse the repository at this point in the history
* Improve error message for unsupported nested comparison

* Update arrow-ord/src/cmp.rs

Co-authored-by: Jay Zhan <[email protected]>

---------

Co-authored-by: Jay Zhan <[email protected]>
  • Loading branch information
alamb and jayzhan211 authored Jun 26, 2024
1 parent 0e56fd5 commit 4b326f6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arrow-ord/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ 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 r_t.is_nested() || l_t.is_nested() {
return Err(ArrowError::InvalidArgumentError(format!(
"Nested comparison: {l_t} {op} {r_t} (hint: use make_comparator instead)"
)));
} else if l_t != r_t {
return Err(ArrowError::InvalidArgumentError(format!(
"Invalid comparison operation: {l_t} {op} {r_t}"
)));
Expand Down

0 comments on commit 4b326f6

Please sign in to comment.