Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of casting StringView/BinaryView to DictionaryArray #5872

Merged
merged 10 commits into from
Jun 13, 2024
Prev Previous commit
Next Next commit
update test
  • Loading branch information
XiangpengHao committed Jun 11, 2024
commit cd8457e20df0403d5ccb0f57396b097f0c1e1429
16 changes: 4 additions & 12 deletions arrow-cast/src/cast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5205,10 +5205,10 @@ mod tests {

const VIEW_TEST_DATA: [Option<&str>; 5] = [
Some("hello"),
Some("world"),
Some("repeated"),
None,
Some("large payload over 12 bytes"),
Some("lulu"),
Some("repeated"),
];

fn _test_string_to_view<O>()
Expand Down Expand Up @@ -5350,23 +5350,15 @@ mod tests {
where
O: OffsetSizeTrait,
{
let data: Vec<Option<&[u8]>> = vec![
Some(b"hello"),
Some(b"world"),
None,
Some(b"large payload over 12 bytes"),
Some(b"lulu"),
];

let view_array = {
let mut builder = BinaryViewBuilder::new().with_block_size(8); // multiple buffers.
for s in data.iter() {
for s in VIEW_TEST_DATA.iter() {
builder.append_option(*s);
}
builder.finish()
};

let expected_binary_array = GenericBinaryArray::<O>::from(data);
let expected_binary_array = GenericBinaryArray::<O>::from_iter(VIEW_TEST_DATA);
let expected_type = expected_binary_array.data_type();

assert!(can_cast_types(view_array.data_type(), expected_type));
Expand Down