Numpy uses the concept of broadcasting to perform math operations on arrays
of different sizes:
https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
A good example is multiplying an array by a single literal value or
comparing an array to a single value.
I'm in the process of converting my project to use Arrow types and this is
one use case where my design differs from Arrow and I am wondering what the
best solution is.
My execution engine applies operations to arrays. I need way to represent
literal values so I can evaluate "a < 5" where 'a' is an array. The result
of this evaluation would be an array of booleans.
My current design has a special type of array to represent a single value:
pub enum ArrayData {
BroadcastVariable(ScalarValue),
Boolean(Vec<bool>),
Float32(Vec<f32>),
Float64(Vec<f64>),
....
}
I could implement some new type that can contain either an Arrow array or a
scalar value, but wondered how others are dealing with this.
Thanks,
Andy.