You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "hailong wang (Jira)" <ji...@apache.org> on 2020/10/12 15:16:00 UTC

[jira] [Updated] (FLINK-19587) Error result when casting binary type as varchar

     [ https://issues.apache.org/jira/browse/FLINK-19587?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

hailong wang updated FLINK-19587:
---------------------------------
    Description: 
The result is error when casting binary type as varchar type.

For example,
{code:java}
@Test
def testCast1(): Unit = {
  testSqlApi(
    "CAST(X'68656c6c6f' as varchar)",
    "hello")
}
{code}
The result is
{code:java}
Expected :hello
Actual   :[B@57fae983
{code}
It is right as follow,
{code:java}
@Test
def testCast(): Unit = {
  testSqlApi(
    "CAST(CAST(X'68656c6c6f' as varbinary) as varchar)",
    "hello")
}
{code}
We just need to change 
{code:java}
case (VARBINARY, VARCHAR | CHAR){code}
to 
{code:java}
case (BINARY | VARBINARY, VARCHAR | CHAR) 
{code}
in ScalarOperatorGens#generateCast.

 

  was:
The result is error when casting binary type as varchar type.

For example,
{code:java}
@Test
def testCast1(): Unit = {
  testSqlApi(
    "CAST(X'68656c6c6f' as varchar)",
    "hello")
}
{code}
The result is
{code:java}
Expected :hello
Actual   :[B@57fae983
{code}
It is right as follow,
{code:java}
@Test
def testCast(): Unit = {
  testSqlApi(
    "CAST(CAST(X'68656c6c6f' as varbinary) as varchar)",
    "hello")
}
{code}
We just need to change 
{code:java}
case (VARBINARY, VARCHAR | CHAR){code}
to 

 
{code:java}
case (BINARY | VARBINARY, VARCHAR | CHAR) 
{code}
in ScalarOperatorGens#generateCast.

 


> Error result when casting binary type as varchar
> ------------------------------------------------
>
>                 Key: FLINK-19587
>                 URL: https://issues.apache.org/jira/browse/FLINK-19587
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.11.0
>            Reporter: hailong wang
>            Priority: Major
>             Fix For: 1.11.0, 1.12.0
>
>
> The result is error when casting binary type as varchar type.
> For example,
> {code:java}
> @Test
> def testCast1(): Unit = {
>   testSqlApi(
>     "CAST(X'68656c6c6f' as varchar)",
>     "hello")
> }
> {code}
> The result is
> {code:java}
> Expected :hello
> Actual   :[B@57fae983
> {code}
> It is right as follow,
> {code:java}
> @Test
> def testCast(): Unit = {
>   testSqlApi(
>     "CAST(CAST(X'68656c6c6f' as varbinary) as varchar)",
>     "hello")
> }
> {code}
> We just need to change 
> {code:java}
> case (VARBINARY, VARCHAR | CHAR){code}
> to 
> {code:java}
> case (BINARY | VARBINARY, VARCHAR | CHAR) 
> {code}
> in ScalarOperatorGens#generateCast.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)