rich-t-kid-datadog commented on code in PR #7713:
URL: https://github.com/apache/arrow-rs/pull/7713#discussion_r2161826579


##########
arrow-cast/src/cast/run_array.rs:
##########
@@ -0,0 +1,152 @@
+use crate::cast::*;
+
+pub(crate) fn run_end_encoded_cast<K: RunEndIndexType>(
+    array: &dyn Array,
+    to_type: &DataType,
+    cast_options: &CastOptions,
+) -> Result<ArrayRef, ArrowError> {
+    match array.data_type() {
+        DataType::RunEndEncoded(_run_end_field, _values_field) => {
+            let run_array = array
+                .as_any()
+                .downcast_ref::<RunArray<K>>()
+                .ok_or_else(|| ArrowError::CastError("Expected 
RunArray".to_string()))?;
+
+            let values = run_array.values();
+
+            match to_type {
+                // CASE 1: Stay as RunEndEncoded, cast only the values
+                DataType::RunEndEncoded(_target_run_end_field, 
target_value_field) => {

Review Comment:
   actually the first point I made doesnt really hold true since` let 
target_type = DataType::RunEndEncoded(
                   Arc::new(Field::new("run_ends", DataType::Int32, false)),
                   Arc::new(Field::new("values", DataType::Utf8, true)),
               );` is possible but I think the silent wrapping of the run_ends 
buffer shouldn't be allowed



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