You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2024/06/26 07:43:39 UTC

(arrow-rs) branch master updated: Improve error message for unsupported nested comparison (#5961)

This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b326f6d055 Improve error message for unsupported nested comparison (#5961)
4b326f6d055 is described below

commit 4b326f6d055e8d37196b2cbef4d7bc48b5fbfc2a
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Wed Jun 26 03:43:34 2024 -0400

    Improve error message for unsupported nested comparison (#5961)
    
    * Improve error message for unsupported nested comparison
    
    * Update arrow-ord/src/cmp.rs
    
    Co-authored-by: Jay Zhan <ja...@gmail.com>
    
    ---------
    
    Co-authored-by: Jay Zhan <ja...@gmail.com>
---
 arrow-ord/src/cmp.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arrow-ord/src/cmp.rs b/arrow-ord/src/cmp.rs
index e1f54ca13e3..26eb0d8d6e4 100644
--- a/arrow-ord/src/cmp.rs
+++ b/arrow-ord/src/cmp.rs
@@ -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}"
         )));