From cf40c4a6edd90b27a54d6148150018e3367315a6 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Wed, 11 May 2022 09:24:12 -0400 Subject: [PATCH] More cleanup --- .../physical-expr/src/expressions/binary.rs | 21 ------------------- .../physical-expr/src/expressions/nullif.rs | 9 ++------ 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/datafusion/physical-expr/src/expressions/binary.rs b/datafusion/physical-expr/src/expressions/binary.rs index 7b04372df3873..7248bb568994c 100644 --- a/datafusion/physical-expr/src/expressions/binary.rs +++ b/datafusion/physical-expr/src/expressions/binary.rs @@ -664,23 +664,6 @@ macro_rules! compute_utf8_op_dyn_scalar { }}; } -/// Invoke a compute kernel on a boolean data array and a scalar value -macro_rules! compute_bool_op_scalar { - ($LEFT:expr, $RIGHT:expr, $OP:ident, $DT:ident) => {{ - use std::convert::TryInto; - let ll = $LEFT - .as_any() - .downcast_ref::<$DT>() - .expect("compute_op failed to downcast array"); - // generate the scalar function name, such as lt_scalar, from the $OP parameter - // (which could have a value of lt) and the suffix _scalar - Ok(Arc::new(paste::expr! {[<$OP _bool_scalar>]}( - &ll, - $RIGHT.try_into()?, - )?)) - }}; -} - /// Invoke a compute kernel on a boolean data array and a scalar value macro_rules! compute_bool_op_dyn_scalar { ($LEFT:expr, $RIGHT:expr, $OP:ident, $OP_TYPE:expr) => {{ @@ -1342,10 +1325,6 @@ fn is_not_distinct_from_null( make_boolean_array(length, true) } -pub fn eq_null(left: &NullArray, _right: &NullArray) -> Result { - Ok((0..left.len()).into_iter().map(|_| None).collect()) -} - fn make_boolean_array(length: usize, value: bool) -> Result { Ok((0..length).into_iter().map(|_| Some(value)).collect()) } diff --git a/datafusion/physical-expr/src/expressions/nullif.rs b/datafusion/physical-expr/src/expressions/nullif.rs index d6d24cc17820b..2ef40272a8ee2 100644 --- a/datafusion/physical-expr/src/expressions/nullif.rs +++ b/datafusion/physical-expr/src/expressions/nullif.rs @@ -17,16 +17,11 @@ use std::sync::Arc; -use crate::expressions::binary::{eq_decimal, eq_decimal_scalar, eq_null}; use arrow::array::Array; use arrow::array::*; use arrow::compute::eq_dyn; use arrow::compute::kernels::boolean::nullif; -use arrow::compute::kernels::comparison::{ - eq, eq_bool, eq_bool_scalar, eq_scalar, eq_utf8, eq_utf8_scalar, -}; -use arrow::datatypes::{DataType, TimeUnit}; -use datafusion_common::ScalarValue; +use arrow::datatypes::DataType; use datafusion_common::{DataFusionError, Result}; use datafusion_expr::ColumnarValue; @@ -108,7 +103,7 @@ pub fn nullif_func(args: &[ColumnarValue]) -> Result { #[cfg(test)] mod tests { use super::*; - use datafusion_common::Result; + use datafusion_common::{Result, ScalarValue}; #[test] fn nullif_int32() -> Result<()> {