brunal opened a new issue, #9458:
URL: https://github.com/apache/arrow-rs/issues/9458

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
   We cannot fully type (on index & value types) a run-end-encoded array value.
   
   | What | Value | Reference |
   |-|-|-|
   | Array | `dyn Array` | `&dyn Array` |
   | RunArray | `RunArray<I: RunArrayIndexType>` | `&RunArray<I>` |
   | TypedRunArray | zilch! | `TypedRunArray<'a, I, V>` |
   
   We can have a value describing a RunArray with a known index type. And we 
can take a reference to it.
   
   But for a RunArray with known index and value types, we can only have a 
reference type, not a value type. This means that we cannot have a function 
return a fresh, fully described run array, with a known value type. We can only 
return a partially-typed RunArray, and add a comment saying what the values 
are. For example, consider the fictional:
   
   ```
   /// Returns a RunArray whose values are `A`.
   fn encode_array<A: Array, I: RunArrayIndexType>(array: A) -> RunArray<A> {
     todo!()
   }
   ```
   It would be nice to return a `TypedRunArray<I, A>`. But that's not possible. 
We can only add a comment, and let the user cast as needed.
   
   **Describe the solution you'd like**
   
   I'd rather see TypedRunArray a value type.
   
   An issue is that an Array cannot both be a `struct RunArray` and a `struct 
TypedRunArray` so there's some type design to do.
   
   Additionally, it would be a backwards-imcompatible change. TypedRunArray 
might have to stay as-is. Maybe introduce `TypedRunArrayValue`, and one can 
make a `TypedRunArray<'_>` from either a `&RunArray` or a `&TypedRunArrayValue`.
   
   **Additional context**
   
   Another defect of the current `TypedRunArray<I, V>` is that `V` is not 
constrained to `impl Array`. Not sure that's intended.


-- 
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