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

Add arrow_cast::base64 and document usage in arrow_json #4975

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

tustvold
Copy link
Contributor

Which issue does this PR close?

Closes #4945
Closes #4967

Rationale for this change

How to safely roundtrip binary data through text formats like JSON and CSV comes up a lot. This PR therefore adds functions to perform base64 conversion and documents how to use them

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label Oct 23, 2023
@@ -50,10 +50,12 @@ half = { version = "2.1", default-features = false }
num = { version = "0.4", default-features = false, features = ["std"] }
lexical-core = { version = "^0.8", default-features = false, features = ["write-integers", "write-floats", "parse-integers", "parse-floats"] }
comfy-table = { version = "7.0", optional = true, default-features = false }
base64 = "0.21"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This crate is incredibly common, and has no additional dependencies, so I am inclined to think this is fine

/// Base64 decode each element of `array` with the provided `engine`
pub fn b64_decode<E: Engine, O: OffsetSizeTrait>(
engine: &E,
array: &GenericBinaryArray<O>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would perhaps be more symmetrical to take a GenericStringArray but it seems unnecessary to mandate UTF-8 data, when the decoding process effectively verifies it anyway

@tustvold tustvold merged commit 14d6c8d into apache:master Oct 23, 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.

arrow_json: support binary deserialization
2 participants