duongcongtoai commented on code in PR #8652:
URL: https://github.com/apache/arrow-rs/pull/8652#discussion_r2612059060
##########
arrow-select/src/interleave.rs:
##########
@@ -1182,4 +1188,296 @@ mod tests {
assert_eq!(v.len(), 1);
assert_eq!(v.data_type(), &DataType::Struct(fields));
}
+ fn create_dict_arr<K: ArrowDictionaryKeyType>(
+ keys: Vec<K::Native>,
+ null_keys: Option<Vec<bool>>,
+ values: Vec<u16>,
+ ) -> ArrayRef {
+ let input_keys =
+ PrimitiveArray::<K>::from_iter_values_with_nulls(keys,
null_keys.map(NullBuffer::from));
+ let input_values = UInt16Array::from_iter_values(values);
+ let input = DictionaryArray::new(input_keys, Arc::new(input_values));
+ Arc::new(input) as ArrayRef
+ }
+
+ fn create_dict_list_arr(
+ keys: Vec<u8>,
+ null_keys: Option<Vec<bool>>,
+ values: Vec<u16>,
+ lengths: Vec<usize>,
+ list_nulls: Option<Vec<bool>>,
+ ) -> ArrayRef {
+ let dict_arr = {
+ let input_1_keys =
+ UInt8Array::from_iter_values_with_nulls(keys,
null_keys.map(NullBuffer::from));
+ let input_1_values = UInt16Array::from_iter_values(values);
+ DictionaryArray::new(input_1_keys, Arc::new(input_1_values))
+ };
+
+ let offset_buffer = OffsetBuffer::<i32>::from_lengths(lengths);
+ let list_arr = GenericListArray::new(
+ Arc::new(Field::new_dictionary(
+ "item",
+ DataType::UInt8,
+ DataType::UInt16,
+ true,
+ )),
+ offset_buffer,
+ Arc::new(dict_arr) as ArrayRef,
+ list_nulls.map(NullBuffer::from_iter),
+ );
+ Arc::new(list_arr) as ArrayRef
+ }
+
+ #[test]
Review Comment:
i added 2 new tests for non nested
- test_total_distinct_keys_in_input_arrays_greater_than_key_size
-
test_total_distinct_keys_in_input_arrays_and_after_interleave_are_greater_than_key_size
--
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]