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

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

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)