Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed May 11, 2022
1 parent 21d3bf5 commit cf40c4a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
21 changes: 0 additions & 21 deletions datafusion/physical-expr/src/expressions/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {{
Expand Down Expand Up @@ -1342,10 +1325,6 @@ fn is_not_distinct_from_null(
make_boolean_array(length, true)
}

pub fn eq_null(left: &NullArray, _right: &NullArray) -> Result<BooleanArray> {
Ok((0..left.len()).into_iter().map(|_| None).collect())
}

fn make_boolean_array(length: usize, value: bool) -> Result<BooleanArray> {
Ok((0..length).into_iter().map(|_| Some(value)).collect())
}
Expand Down
9 changes: 2 additions & 7 deletions datafusion/physical-expr/src/expressions/nullif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -108,7 +103,7 @@ pub fn nullif_func(args: &[ColumnarValue]) -> Result<ColumnarValue> {
#[cfg(test)]
mod tests {
use super::*;
use datafusion_common::Result;
use datafusion_common::{Result, ScalarValue};

#[test]
fn nullif_int32() -> Result<()> {
Expand Down

0 comments on commit cf40c4a

Please sign in to comment.