You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Jefffrey (via GitHub)" <gi...@apache.org> on 2026/10/22 12:21:30 UTC

[PR] [57_maintenance] fix: account for offsets in runarrays when using extend for MutableArrayData [arrow-rs]

Jefffrey opened a new pull request, #11815:
URL: https://github.com/apache/arrow-rs/pull/11815

   - Backport https://github.com/apache/arrow-rs/pull/11546
   - For inclusion in https://github.com/apache/arrow-rs/issues/11666
   
   Cherry-pick of https://github.com/apache/arrow-rs/commit/2e26ab4b0baa351ca59945a1988685b974861e63


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [57_maintenance] fix: account for offsets in runarrays when using extend for MutableArrayData [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #11815:
URL: https://github.com/apache/arrow-rs/pull/11815


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [57_maintenance] fix: account for offsets in runarrays when using extend for MutableArrayData [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #11815:
URL: https://github.com/apache/arrow-rs/pull/11815#discussion_r4348242133


##########
arrow-data/src/transform/run.rs:
##########
@@ -644,4 +648,63 @@ mod tests {
         // This should cause overflow: (i32::MAX - 50) + 100 > i32::MAX
         mutable.extend(0, 0, 100);
     }
+
+    #[test]
+    #[should_panic(expected = "run end overflow")]
+    fn test_extend_nulls_overflow() {
+        let values = create_int32_array_data(vec![10]);
+        let array = create_run_array_data_int16(vec![100], values);
+
+        let mut mutable = MutableArrayData::new(vec![&array], true, 10);
+        mutable.extend_nulls(i16::MAX as usize + 1);
+    }
+
+    #[test]
+    fn test_extend_accounts_for_offset() {
+        let dt = DataType::RunEndEncoded(
+            Arc::new(Field::new("run_ends", DataType::Int32, false)),
+            Arc::new(Field::new("values", DataType::Float32, true)),
+        );
+
+        let runs = ArrayData::builder(DataType::Int32)
+            .len(2)
+            .offset(2)
+            .add_buffer(vec![-10_i32, -20, 1_i32, 4, 0, 100].into())
+            .build()
+            .unwrap();
+        let values = ArrayData::builder(DataType::Float32)
+            .len(2)
+            .add_buffer(vec![1.5, 2.5].into())
+            .build()
+            .unwrap();
+
+        let source_data = ArrayDataBuilder::new(dt.clone())
+            .len(3)
+            .child_data(vec![runs, values])
+            .build()
+            .unwrap();
+
+        let mut mutable = MutableArrayData::new(vec![&source_data], true, 10);
+        mutable.extend(0, 0, 1);
+        let data = mutable.freeze();
+
+        let expected = {

Review Comment:
   - since we're not backporting #11536 (see https://github.com/apache/arrow-rs/issues/11666#issuecomment-6339967324) i adjusted the test so equality can be done without needing logical comparison



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org