You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Chris MacGregor (Jira)" <ji...@apache.org> on 2026/04/01 16:18:00 UTC

[jira] [Updated] (FLINK-39384) PyFlink load_plan() CompiledPlans cannot be executed

     [ https://issues.apache.org/jira/browse/FLINK-39384?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris MacGregor updated FLINK-39384:
------------------------------------
    Description: 
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. I haven't also tested it, but looking at the source code it looks like 2.2 is also affected and that it is still a bug in master.

  was:
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.


> 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.1.0, 2.2.0
>            Reporter: Chris MacGregor
>            Priority: Major
>
> 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. I haven't also tested it, but looking at the source code it looks like 2.2 is also affected and that it is still a bug in master.



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