Skip to content

Commit

Permalink
Update Base64 documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe-Abraham committed Sep 20, 2024
1 parent 53a291a commit fc40b09
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions velox/docs/functions/presto/binary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Binary Functions

.. function:: from_base64(string) -> varbinary

Decodes a Base64-encoded ``string`` back into its original binary form.
This function is capable of handling both fully padded and non-padded Base64 encoded strings.
Partially padded Base64 strings are not supported and will result in an error.
Decodes a Base64-encoded ``string`` back into its original binary form.
This function is capable of handling both fully padded and non-padded Base64 encoded strings.
Partially padded Base64 strings are not supported and will result in a "UserError" status being returned.

Examples
--------
Expand All @@ -24,10 +24,10 @@ Binary Functions

Query with partial-padded Base64 string:
::
SELECT from_base64('SGVsbG8gV29ybGQgZm9yIHZlbG94IQ='); -- Error : Base64::decode() - invalid input string: string length is not a multiple of 4.
SELECT from_base64('SGVsbG8gV29ybGQgZm9yIHZlbG94IQ='); -- UserError: Base64::decode() - invalid input string: string length is not a multiple of 4.

In the above examples, both the fully padded and non-padded Base64 strings ('SGVsbG8gV29ybGQ=' and 'SGVsbG8gV29ybGQ') decode to the binary representation of the text 'Hello World'.
While, partial-padded Base64 string 'SGVsbG8gV29ybGQgZm9yIHZlbG94IQ=' will lead to an velox error.
A partial-padded Base64 string 'SGVsbG8gV29ybGQgZm9yIHZlbG94IQ=' will result in a "UserError" status indicating the Base64 string is invalid.

.. function:: from_base64url(string) -> varbinary

Expand Down

0 comments on commit fc40b09

Please sign in to comment.