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

Use ArrayFormatter in cast kernel #4668

Merged
merged 4 commits into from
Aug 9, 2023

Conversation

tustvold
Copy link
Contributor

@tustvold tustvold commented Aug 9, 2023

Which issue does this PR close?

Closes #4669

Rationale for this change

What changes are included in this PR?

Follow up to #4666 uses ArrayFormatter in more places instead of custom logic

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label Aug 9, 2023
@@ -622,21 +622,6 @@ where
Ok(Arc::new(array))
}

// cast the List array to Utf8 array
macro_rules! cast_list_to_string {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing to use ArrayFormatter is both faster, as it avoids intermediate string allocations, whilst also respecting format options

@@ -8989,4 +8950,19 @@ mod tests {
fn test_const_options() {
assert!(CAST_OPTIONS.safe)
}

#[test]
fn test_list_format_options() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test for #4669

Copy link
Member

@viirya viirya left a comment

Choose a reason for hiding this comment

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

It looks good that it removes custom logic in many places.

@tustvold tustvold merged commit cefb8c1 into apache:master Aug 9, 2023
25 checks passed
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.

Casting List to String Ignores Format Options
2 participants