[
https://issues.apache.org/jira/browse/SPARK-28121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16935582#comment-16935582
]
jiaan.geng commented on SPARK-28121:
------------------------------------
[~smilegator] I find the encode function of Postgresql exists some issue.
First, according to the description of encode function, we know this function
could encode binary data into a textual representation. Supported formats are:
{{base64}}, {{hex}}, {{escape}}. {{escape}} converts zero bytes and
high-bit-set bytes to octal sequences ({{\}}_{{nnn}}_) and doubles backslashes.
But, I find the behavior is different as follows:
{code:java}
select encode(E'123//000456'::bytea, 'escape');
select encode('123//000456'::bytea, 'escape');
// all the result is '123//000456'
{code}
It seems no effective.
The encode function of MySql is used to encrypt and uncode used to decrypt.
The encode function of Vertica is used to compare.
No other mainstream database implements this function.
> String Functions: decode/encode can not accept 'escape' and 'hex' as charset
> ----------------------------------------------------------------------------
>
> Key: SPARK-28121
> URL: https://issues.apache.org/jira/browse/SPARK-28121
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Affects Versions: 3.0.0
> Reporter: Yuming Wang
> Priority: Major
>
> {noformat}
> postgres=# select decode('1234567890','escape');
> decode
> ------------------------
> \x31323334353637383930
> (1 row)
> {noformat}
> {noformat}
> spark-sql> select decode('1234567890','escape');
> 19/06/20 01:57:33 ERROR SparkSQLDriver: Failed in [select
> decode('1234567890','escape')]
> java.io.UnsupportedEncodingException: escape
> at java.lang.StringCoding.decode(StringCoding.java:190)
> at java.lang.String.<init>(String.java:426)
> at java.lang.String.<init>(String.java:491)
> ...
> spark-sql> select decode('ff','hex');
> 19/08/16 21:44:55 ERROR SparkSQLDriver: Failed in [select decode('ff','hex')]
> java.io.UnsupportedEncodingException: hex
> at java.lang.StringCoding.decode(StringCoding.java:190)
> at java.lang.String.<init>(String.java:426)
> at java.lang.String.<init>(String.java:491)
> {noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]