duongcongtoai commented on code in PR #8652:
URL: https://github.com/apache/arrow-rs/pull/8652#discussion_r2604008829
##########
arrow-data/src/transform/mod.rs:
##########
@@ -672,12 +674,24 @@ impl<'a> MutableArrayData<'a> {
next_offset += dict_len;
}
- build_extend_dictionary(array, offset, offset +
dict_len)
+ // -1 since offset is exclusive
Review Comment:
this will trigger the error part
```
#[test]
fn test_uint8_dictionary_overflow_with_256_items() {
let dict_arr = {
let input_1_keys = UInt8Array::from_iter_values(0..=255);
let input_1_values = UInt8Array::from_iter_values(0..=255);
let input_1 = DictionaryArray::new(input_1_keys,
Arc::new(input_1_values));
input_1
};
let arr1 = Arc::new(dict_arr) as ArrayRef;
let arr2 = arr1.clone();
concat(&[&arr1, &arr2]).unwrap();
}
```
when it reaches this function
```
build_extend_dictionary(array, offset, offset +
dict_len)
.ok_or(ArrowError::DictionaryKeyOverflowError)
```
offset will be 0, dict_len is 256, and build_extend_dictionary will try cast
256 as u8, which will throw error DictionaryKeyOverflowError, while it
shouldn't be. The test passes anyway because we already added a fallback for
this error
--
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]