Skip to content

Commit

Permalink
impl Datum for &dyn Datum
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan-Fenner committed Nov 10, 2023
1 parent b99270a commit 55b0983
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 6 additions & 0 deletions arrow-array/src/scalar.rs
Expand Up @@ -98,6 +98,12 @@ impl Datum for &dyn Array {
}
}

impl<'a> Datum for &'a dyn Datum {
fn get(&self) -> (&dyn Array, bool) {
(*self).get()
}
}

/// A wrapper around a single value [`Array`] that implements
/// [`Datum`] and indicates [compute] kernels should treat this array
/// as a scalar value (a single value).
Expand Down
10 changes: 0 additions & 10 deletions arrow-select/src/zip.rs
Expand Up @@ -35,16 +35,6 @@ pub fn zip(
let (truthy, truthy_is_scalar) = truthy.get();
let (falsy, falsy_is_scalar) = falsy.get();

zip_impl(mask, truthy, truthy_is_scalar, falsy, falsy_is_scalar)
}

fn zip_impl(
mask: &BooleanArray,
truthy: &dyn Array,
truthy_is_scalar: bool,
falsy: &dyn Array,
falsy_is_scalar: bool,
) -> Result<ArrayRef, ArrowError> {
if truthy.data_type() != falsy.data_type() {
return Err(ArrowError::InvalidArgumentError(
"arguments need to have the same data type".into(),
Expand Down

0 comments on commit 55b0983

Please sign in to comment.