[jira] [Created] (FLINK-12389) flink codegen set String type for ByteBuffer fields

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

[jira] [Created] (FLINK-12389) flink codegen set String type for ByteBuffer fields

Shang Yuanchun (Jira)
Yu Yang created FLINK-12389:
-------------------------------

             Summary: flink codegen set String type for ByteBuffer fields
                 Key: FLINK-12389
                 URL: https://issues.apache.org/jira/browse/FLINK-12389
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Runtime
    Affects Versions: 1.8.0
            Reporter: Yu Yang


We try to write a simple flink sql program using "select  .. from " statement, and encounter  a compile exception.

*Caused by: org.codehaus.commons.compiler.CompileException: Line 110, Column 38: Cannot cast "java.nio.ByteBuffer" to "java.lang.String"*

Further debugging shows that the following flink-generated code snippet caused problem:

{code}
  final java.lang.reflect.Field field_com$pinterest$utzv2$thrift$RealtimeSpendValue_segmentIds =
      org.apache.flink.api.java.typeutils.TypeExtractor.getDeclaredField(
        com.pinterest.utzv2.thrift.RealtimeSpendValue.class, "segmentIds");
...

    boolean isNull$5 = (java.nio.ByteBuffer) field_com$pinterest$utzv2$thrift$RealtimeSpendValue_segmentIds.get(in1) == null;
    java.lang.String result$4;
    if (isNull$5) {
      result$4 = "";
    }
    else {
      result$4 = (java.lang.String) (java.nio.ByteBuffer) field_com$pinterest$utzv2$thrift$RealtimeSpendValue_segmentIds.get(in1);
    }
   
{code}

The following is the stack track:

Caused by: org.apache.flink.runtime.client.JobExecutionException: Job execution failed.
        at org.apache.flink.runtime.jobmaster.JobResult.toJobExecutionResult(JobResult.java:146)
        at org.apache.flink.client.program.rest.RestClusterClient.submitJob(RestClusterClient.java:265)
        ... 17 more
Caused by: org.apache.flink.api.common.InvalidProgramException: Table program cannot be compiled. This is a bug. Please file an issue.
        at org.apache.flink.table.codegen.Compiler$class.compile(Compiler.scala:36)
        at org.apache.flink.table.runtime.CRowOutputProcessRunner.compile(CRowOutputProcessRunner.scala:36)
        at org.apache.flink.table.runtime.CRowOutputProcessRunner.open(CRowOutputProcessRunner.scala:50)
        at org.apache.flink.api.common.functions.util.FunctionUtils.openFunction(FunctionUtils.java:36)
        at org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator.open(AbstractUdfStreamOperator.java:102)
        at org.apache.flink.streaming.api.operators.ProcessOperator.open(ProcessOperator.java:56)
        at org.apache.flink.streaming.runtime.tasks.StreamTask.openAllOperators(StreamTask.java:425)
        at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:291)
        at org.apache.flink.runtime.taskmanager.Task.run(Task.java:711)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.codehaus.commons.compiler.CompileException: Line 110, Column 38: Cannot cast "java.nio.ByteBuffer" to "java.lang.String"
        at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12124)
        at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5049)
        at org.codehaus.janino.UnitCompiler.access$8600(UnitCompiler.java:215)
        at org.codehaus.janino.UnitCompiler$16.visitCast(UnitCompiler.java:4416)
        at org.codehaus.janino.UnitCompiler$16.visitCast(UnitCompiler.java:4394)
        at org.codehaus.janino.Java$Cast.accept(Java.java:4887)
        at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4394)
        at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5575)
        at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:3790)
        at org.codehaus.janino.UnitCompiler.access$6100(UnitCompiler.java:215)
        at org.codehaus.janino.UnitCompiler$13.visitAssignment(UnitCompiler.java:3752)
        at org.codehaus.janino.UnitCompiler$13.visitAssignment(UnitCompiler.java:3732)
        at org.codehaus.janino.Java$Assignment.accept(Java.java:4466)
        at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3732)
        at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2360)
        at org.codehaus.janino.UnitCompiler.access$1800(UnitCompiler.java:215)
        at org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1494)
        at org.codehaus.janino.UnitCompiler$6.visitExpressionStatement(UnitCompiler.java:1487)
        at org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:2871)
        at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1487)
        at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1567)
        at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1553)
        at org.codehaus.janino.UnitCompiler.access$1700(UnitCompiler.java:215)
        at org.codehaus.janino.UnitCompiler$6.visitBlock(UnitCompiler.java:1493)
        at org.codehaus.janino.UnitCompiler$6.visitBlock(UnitCompiler.java:1487)
        at org.codehaus.janino.Java$Block.accept(Java.java:2776)
        at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1487)
        at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2468)
        at org.codehaus.janino.UnitCompiler.access$1900(UnitCompiler.java:215)
        at org.codehaus.janino.UnitCompiler$6.visitIfStatement(UnitCompiler.java:1495)
        at org.codehaus.janino.UnitCompiler$6.visitIfStatement(UnitCompiler.java:1487)
        at org.codehaus.janino.Java$IfStatement.accept(Java.java:2947)
        at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1487)
        at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1567)
        at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3388)
        at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1357)
        at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1330)
        at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:822)
        at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:432)
        at org.codehaus.janino.UnitCompiler.access$400(UnitCompiler.java:215)
        at org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:411)
        at org.codehaus.janino.UnitCompiler$2.visitPackageMemberClassDeclaration(UnitCompiler.java:406)
        at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:1414)
        at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:406)
        at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:378)
        at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:237)
        at org.codehaus.janino.SimpleCompiler.compileToClassLoader(SimpleCompiler.java:465)
        at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:216)
        at org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:207)
        at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:80)
        at org.codehaus.commons.compiler.Cookable.cook(Cookable.java:75)
        at org.apache.flink.table.codegen.Compiler$class.compile(Compiler.scala:33)
        ... 9 more





--
This message was sent by Atlassian JIRA
(v7.6.3#76005)