Skip to content

Conversation

@colinmarc
Copy link
Contributor

This changes the decode built-in function so that SQL like the following works:

decode('cXdlcXc=', 'base64');

Padding isn't required to decode correctly, but it's surprising to users if we just reject it outright.

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Oct 24, 2025
@colinmarc colinmarc force-pushed the base64-decode-padding branch from b765cc8 to 28d1f32 Compare October 24, 2025 09:00
Padding isn't required to decode correctly, but it's surprising to users
if we just reject it outright.
@colinmarc colinmarc force-pushed the base64-decode-padding branch from 28d1f32 to 2b95390 Compare October 24, 2025 09:38
Copy link
Contributor

@Jefffrey Jefffrey left a comment

Choose a reason for hiding this comment

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

The fix for decoding makes sense (TIL padding isn't strictly required)

Though for encoding, is it better to keep padding for wider compatibility?

@colinmarc
Copy link
Contributor Author

That could break existing queries, since the existing implementation doesn't add padding, so I didn't make the change. (But I'm not opposed if you'd like me to add it).

@Jefffrey
Copy link
Contributor

That could break existing queries, since the existing implementation doesn't add padding, so I didn't make the change. (But I'm not opposed if you'd like me to add it).

Ah disregard me, I read the docs wrong 😅

I thought the STANDARD_NO_PAD added padding on encodes (even though the name clearly hints otherwise...)

All good 👍

@Jefffrey Jefffrey added this pull request to the merge queue Oct 25, 2025
Merged via the queue into apache:main with commit eef1c9e Oct 25, 2025
28 checks passed
@colinmarc colinmarc mentioned this pull request Oct 27, 2025
26 tasks
tobixdev pushed a commit to tobixdev/datafusion that referenced this pull request Nov 2, 2025
This changes the `decode` built-in function so that SQL like the
following works:

```sql
decode('cXdlcXc=', 'base64');
```

Padding isn't required to decode correctly, but it's surprising to users
if we just reject it outright.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants