Skip to content

Conversation

@lyne7-sc
Copy link
Contributor

Which issue does this PR close?

Part of: #15914

Rationale for this change

Implement spark compatible unhex functions:
https://spark.apache.org/docs/latest/api/sql/index.html#unhex

What changes are included in this PR?

Are these changes tested?

Yes. UTs and SLT added.

Are there any user-facing changes?

No.

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) spark labels Jan 20, 2026
I: Iterator<Item = Option<T>>,
T: AsRef<str>,
{
let mut builder = BinaryBuilder::with_capacity(len, len * 32);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 32?

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 was chosen based on benchmark results and seemed like a reasonable initial estimate. Thanks for pointing this out, for StringArray and LargeStringArray we can use a more accurate capacity from values().len(). I’ve updated the code accordingly.

@lyne7-sc
Copy link
Contributor Author

Thanks for the review and for pointing this out. I’ve updated the implementation accordingly, and the tests have been updated as well and added to the STLs.

@alamb alamb added this pull request to the merge queue Jan 22, 2026
@alamb
Copy link
Contributor

alamb commented Jan 22, 2026

🚀

Merged via the queue into apache:main with commit 736fa7c Jan 22, 2026
51 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spark sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants