Nathan-Fenner commented on code in PR #5086:
URL: https://github.com/apache/arrow-rs/pull/5086#discussion_r1397705929


##########
arrow-select/src/zip.rs:
##########
@@ -29,19 +29,39 @@ use arrow_schema::ArrowError;
 /// * `falsy` - Values of this array are taken if mask evaluates `false`
 pub fn zip(
     mask: &BooleanArray,
-    truthy: &dyn Array,
-    falsy: &dyn Array,
+    truthy: impl Datum,

Review Comment:
   Existing callers of `zip` (including e.g. me) may be passing a `&dyn Array` 
into this function, i.e.
   
   ```rs
   fn my_func(some_thing: MyThing) {
     let mask: &BooleanArray = some_thing.get_mask();
     let left: &dyn Array = some_thing.get_left();
     let right: &dyn Array = some_thing.get_right();
   
     let zipped = arrow::compute::zip(
       mask,
       left,
       right,
     );
   
     ...
   }
   ```
   
   If the signature is changed from `&dyn Array` to `&dyn Datum`, you'll get a 
type error:
   
   ```
      |     -------- ^ expected trait `Datum`, found trait `Array`
      |     |
      |     arguments to this function are incorrect
   ```
   
   but with `impl Datum`, the call remains reverse-compatible. Otherwise, this 
is a breaking type change.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to