Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-15478

FROM_BASE64 code gen type wrong

    XMLWordPrintableJSON

Details

    Description

      `FROM_BASE64` should return String instead of byte[]

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

       

      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]
      

       

      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. 

       

      Attachments

        Issue Links

          Activity

            People

              libenchao Benchao Li
              libenchao Benchao Li
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m