Chris MacGregor created FLINK-39384:
---------------------------------------

             Summary: PyFlink load_plan() CompiledPlans cannot be executed
                 Key: FLINK-39384
                 URL: https://issues.apache.org/jira/browse/FLINK-39384
             Project: Flink
          Issue Type: Bug
          Components: API / Python
    Affects Versions: 2.2.0, 2.1.0
            Reporter: Chris MacGregor


Using the Python Flink API, attempting the following:
{quote}TableEnvironment.load_plan(filename).execute()
{quote}
Results in the following error:
{quote}An error occurred while calling o11._before_execute. Trace:
org.apache.flink.api.python.shaded.py4j.Py4JException: Method 
_before_execute([]) does not exist
at 
org.apache.flink.api.python.shaded.py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:321)
at 
org.apache.flink.api.python.shaded.py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:329)
at org.apache.flink.api.python.shaded.py4j.Gateway.invoke(Gateway.java:274)
at 
org.apache.flink.api.python.shaded.py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at 
org.apache.flink.api.python.shaded.py4j.commands.CallCommand.execute(CallCommand.java:79)
at 
org.apache.flink.api.python.shaded.py4j.GatewayConnection.run(GatewayConnection.java:238)
at java.base/java.lang.Thread.run(Unknown Source)
{quote}
I believe the fault is in {{{}TableEnvironment.load_plan(){}}}, specifically 
that the CompiledPlan returned should have {{t_env=self}} but it currently has 
{{{}t_env=self._j_tenv{}}}, meaning that the code is trying to call 
{{_before_execute}} on the Java gateway object and not the local 
TableEnvironment handle.

For comparison, if I were to do:
{quote}TableEnvironment.create_statement_set().compile_plan().execute()
{quote}
the {{t_env}} of the compiled plan is set appropriately and the plan executes 
as expected.

I created a patched container image of the flink:2.1.0 container replacing 
{{self._j_tenv}} with {{self}} in {{load_plan()}} and I was then able to 
execute the loaded plan.

I haven't tested the code to confirm but I suspect that 
{{TableEnvironment.compile_plan_sql()}} has the same underlying bug.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to