jayzhan211 commented on code in PR #12059:
URL: https://github.com/apache/arrow-rs/pull/12059#discussion_r4785483288


##########
arrow-select/src/dictionary.rs:
##########
@@ -264,6 +271,7 @@ pub(crate) fn should_merge_dictionary_values<K: 
ArrowDictionaryKeyType>(
     (
         !single_dictionary && (overflow || values_exceed_length),
         overflow,
+        single_dictionary,

Review Comment:
   Could you add a test for values that share offsets and data buffers but have 
different null buffers? Now that this flag decides which values the output 
keeps, the null-buffer check in `bytes_ptr_eq` is the only thing keeping those 
inputs off the shared path, and no test covers it: with that check dropped, all 
531 `arrow-select` unit tests still pass, but the test below returns `[None, 
None]` instead of `[None, Some("b")]`.
   
   <details>
   <summary>Test for interleave.rs (passes on this head, fails when 
bytes_ptr_eq ignores nulls)</summary>
   
   ```rs
   #[test]
   fn test_interleave_dictionary_values_with_different_nulls_are_not_shared() {
       let values = StringArray::from_iter_values(["a", "b", "c"]);
       // Same offsets and data buffers as `values`, but "b" is null.
       let values_with_null: ArrayRef = Arc::new(StringArray::new(
           values.offsets().clone(),
           values.values().clone(),
           Some(NullBuffer::from(&[true, false, true])),
       ));
       let dict_a = 
DictionaryArray::<Int32Type>::new(Int32Array::from(vec![1]), values_with_null);
       let dict_b = 
DictionaryArray::<Int32Type>::new(Int32Array::from(vec![1]), Arc::new(values));
   
       let result = interleave(&[&dict_a, &dict_b], &[(0, 0), (1, 0)]).unwrap();
       let result = result.as_dictionary::<Int32Type>();
       let strings: Vec<_> = result
           .downcast_dict::<StringArray>()
           .unwrap()
           .into_iter()
           .collect();
       assert_eq!(strings, vec![None, Some("b")]);
   }
   ```
   
   </details>



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