Skip to content

Support concatenation of mixed FixedSizeBinary via concat_elements_dyn#10222

Open
pepijnve wants to merge 4 commits into
apache:mainfrom
pepijnve:fixed_size_binary_concat
Open

Support concatenation of mixed FixedSizeBinary via concat_elements_dyn#10222
pepijnve wants to merge 4 commits into
apache:mainfrom
pepijnve:fixed_size_binary_concat

Conversation

@pepijnve

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

None; relates to apache/datafusion#23211

Rationale for this change

concat_elements_fixed_size_binary supports concatenation of FixedSizeBinary(n) and FixedSizeBinary(m), but the guard clause in concat_elements_dyn prevents this from actually being possible with dyn Array.

What changes are included in this PR?

Adjust the guard clause in concat_elements_dyn to allow concatenation of mixed FixedSizeBinary types.

Are these changes tested?

  • Added an extra test case for mixed FixedSizeBinary specifically
  • Adjusted the existing unit tests to use concat_elements_dyn. This maintains coverage of the functions that were being called (since they're still called indirectly) while increasing the coverage concat_elements_dyn

Are there any user-facing changes?

Yes, the pre conditions of the function are relaxed. This should not be a breaking change.

@github-actions github-actions Bot added the arrow Changes to the arrow crate label Jun 26, 2026
Comment thread arrow-string/src/concat_elements.rs Outdated
Comment on lines +874 to +877
assert_eq!(
output.as_any().downcast_ref::<BinaryViewArray>().unwrap(),
&expected
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert_eq!(
output.as_any().downcast_ref::<BinaryViewArray>().unwrap(),
&expected
);
assert_eq!(output.as_binary_view(), &expected);

with use arrow_array::cast::AsArray

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's much better. I've cleaned up all the tests that were still using more verbose patterns.

Comment thread arrow-string/src/concat_elements.rs Outdated
Comment on lines +590 to +593
assert_eq!(
output.as_any().downcast_ref::<StringArray>().unwrap(),
&expected
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert_eq!(
output.as_any().downcast_ref::<StringArray>().unwrap(),
&expected
);
assert_eq!(output.as_string::<i32>(), &expected);

similarly etc.

@@ -406,55 +406,59 @@ pub fn concat_elements_string_view_array(
///
/// This function errors if the arrays are of different types.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we need to slightly update this docstring 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some extra text to make the FixedSizeBinary support explicit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants