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

fix(snowflake): add support for HEX_DECODE_BINARY #4855

Merged
merged 4 commits into from
Mar 7, 2025

Conversation

sk-
Copy link
Contributor

@sk- sk- commented Mar 7, 2025

The HEX_DECODE_BINARY function is equivalent to the Unhex function that is already supported by sqlglot. To support it, we just had to add the map in snowflake and add the transform in duckdb.

Partially solves #4852, we still need to add support for HEX_DECODE_STRING.

Testing:
Duckdb (playground)

Screenshot 2025-03-07 at 6 40 35 PM

Bigquery
(Note that Bigquery outputs binary data (bytes) in base64)
Screenshot 2025-03-07 at 6 23 06 PM

Snowflake
(Note that Snowflake outputs binary data in hex format)
Screenshot 2025-03-07 at 6 34 53 PM

The [FROM_HEX_BINARY](https://docs.snowflake.com/en/sql-reference/functions/hex_decode_binary) frunction is equivalent to the `Unhex` function that is already supported by sqlglot. To support it, we just had to add the map in snowflake and add the transform in duckdb.

Partially solves tobymao#4852, we still need to add support for `FROM_HEX_STRING`.
@sk- sk- changed the title fix(snowflake): add support for FROM_HEX_BINARY fix(snowflake): add support for HEX_DECODE_BINARY Mar 7, 2025
@sk- sk- requested a review from georgesittas March 7, 2025 21:43
Copy link
Collaborator

@georgesittas georgesittas left a comment

Choose a reason for hiding this comment

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

Thanks!

@georgesittas georgesittas linked an issue Mar 7, 2025 that may be closed by this pull request
@georgesittas georgesittas merged commit 54be278 into tobymao:main Mar 7, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Snowflake's HEX_DECODE_BINARY
2 participants