[ https://issues.apache.org/jira/browse/HIVE-6560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14064259#comment-14064259 ]
Xuefu Zhang commented on HIVE-6560: ----------------------------------- Patch committed to trunk. Thanks Chao for the contribution. > varchar and char types cannot be cast to binary > ----------------------------------------------- > > Key: HIVE-6560 > URL: https://issues.apache.org/jira/browse/HIVE-6560 > Project: Hive > Issue Type: Bug > Components: Types, UDF > Affects Versions: 0.12.0, 0.13.0, 0.13.1 > Reporter: Xuefu Zhang > Assignee: Chao > Attachments: HIVE-6560.1.patch, HIVE-6560.2.patch, HIVE-6560.3.patch > > > GenericUDFToBinary can convert string to binary. VARCHAR and CHAR are > substitutable with string. Thus, GenericUDFToBinary should also be able to > convert VARCHAR and CHAR to binary. However, > {code} > hive> select binary(cast('abc' as varchar(5)) from decimal_udf limit 1; > FAILED: ParseException line 1:40 missing ) at 'from' near '<EOF>' > hive> select binary(cast('abc' as varchar(5))) from decimal_udf limit 1; > FAILED: SemanticException Line 0:-1 Wrong arguments ''abc'': Only string or > binary data can be cast into binary data types. > {code} -- This message was sent by Atlassian JIRA (v6.2#6252)