[jira] [Created] (FLINK-15478) FROM_BASE64 code gen type wrong

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-15478) FROM_BASE64 code gen type wrong

Shang Yuanchun (Jira)
Benchao Li created FLINK-15478:
----------------------------------

             Summary: FROM_BASE64 code gen type wrong
                 Key: FLINK-15478
                 URL: https://issues.apache.org/jira/browse/FLINK-15478
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
    Affects Versions: 1.9.1, 1.10.0
            Reporter: Benchao Li


`FROM_BASE64` should return *String* instead of *byte[]*

If ** we use FROM_BASE64 in sql, will result in a exception:

 
{code:java}
org.apache.flink.table.planner.codegen.CodeGenException: Incompatible types of expression and result type. Expression[GeneratedExpression(result$2,isNull$1,isNull$1 = false;
result$2 = null;
if (!isNull$1) {
 
  result$2 = org.apache.flink.table.runtime.functions.SqlFunctionUtils.fromBase64(((org.apache.flink.table.dataformat.BinaryString) str$0));
  isNull$1 = (result$2 == null);
}
,BYTES,None)] type is [BYTES], result type is [STRING NOT NULL]
{code}
 

Why ScalarFunctionsTest.testFromBase64 passed?

Because we assume the result should be string in ExpressionTestBase, then add a cast operator to the result of FROM_BASE64. 

 



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