You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by vi...@apache.org on 2022/06/27 16:52:01 UTC

[arrow-datafusion] branch master updated: Don't treat Null as UTF8(None) and change error info. (#2801)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7617d7880 Don't treat Null as UTF8(None) and change error info. (#2801)
7617d7880 is described below

commit 7617d78809d4ff5bde31142e0744c70024e40635
Author: Kun Liu <li...@apache.org>
AuthorDate: Tue Jun 28 00:51:56 2022 +0800

    Don't treat Null as UTF8(None) and change error info. (#2801)
    
    * inlist: remove check path for UTF8::(None) for NULL value
    
    * format code
---
 datafusion/physical-expr/src/expressions/in_list.rs | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/datafusion/physical-expr/src/expressions/in_list.rs b/datafusion/physical-expr/src/expressions/in_list.rs
index a0448a1f1..729d066d6 100644
--- a/datafusion/physical-expr/src/expressions/in_list.rs
+++ b/datafusion/physical-expr/src/expressions/in_list.rs
@@ -111,8 +111,7 @@ macro_rules! make_contains {
                 ColumnarValue::Scalar(s) => match s {
                     ScalarValue::$SCALAR_VALUE(Some(v)) => Some(*v),
                     ScalarValue::$SCALAR_VALUE(None) => None,
-                    ScalarValue::Utf8(None) => None,
-                    datatype => unimplemented!("Unexpected type {} for InList", datatype),
+                    datatype => unreachable!("InList can't reach other data type {} for {}.", datatype, s),
                 },
                 ColumnarValue::Array(_) => {
                     unimplemented!("InList does not yet support nested columns.")
@@ -163,9 +162,7 @@ macro_rules! make_contains_primitive {
                 ColumnarValue::Scalar(s) => match s {
                     ScalarValue::$SCALAR_VALUE(Some(v)) => Some(*v),
                     ScalarValue::$SCALAR_VALUE(None) => None,
-                    // TODO this is bug, for primitive the expr list should be cast to the same data type
-                    ScalarValue::Utf8(None) => None,
-                    datatype => unimplemented!("Unexpected type {} for InList", datatype),
+                    datatype => unreachable!("InList can't reach other data type {} for {}.", datatype, s),
                 },
                 ColumnarValue::Array(_) => {
                     unimplemented!("InList does not yet support nested columns.")
@@ -317,11 +314,10 @@ fn make_list_contains_decimal(
         .flat_map(|v| match v {
             ColumnarValue::Scalar(s) => match s {
                 Decimal128(v128op, _, _) => *v128op,
-                _ => {
-                    unreachable!(
-                        "InList can't reach other data type for decimal data type."
-                    )
-                }
+                datatype => unreachable!(
+                    "InList can't reach other data type {} for {}.",
+                    datatype, s
+                ),
             },
             ColumnarValue::Array(_) => {
                 unimplemented!("InList does not yet support nested columns.")
@@ -360,8 +356,8 @@ fn make_set_contains_decimal(
         .iter()
         .flat_map(|v| match v {
             Decimal128(v128op, _, _) => *v128op,
-            _ => {
-                unreachable!("InList can't reach other data type for decimal data type.")
+            datatype => {
+                unreachable!("InList can't reach other data type {} for {}.", datatype, v)
             }
         })
         .collect::<Vec<_>>();