Jeff Levesque
08/20/2023, 11:53 PM{
"applicationARN": "arn:aws:kinesisanalytics:us-east-1:xxxxxxxxxxxx:application/yyyy",
"applicationVersionId": "2",
"locationInformation": "org.apache.flink.client.python.PythonDriver.main(PythonDriver.java:124)",
"logger": "org.apache.flink.client.python.PythonDriver",
"message": "is_local: False\nis_local: False\nTraceback (most recent call last):\n File "/tmp/flink-web-5ad4fcf7-d307-40ce-b10b-1a2ebb949646/flink-web-upload/b48844c7-d529-4377-a644-f5d12081b15a_code/window.py", line 361, in \n main()\n File "/tmp/flink-web-5ad4fcf7-d307-40ce-b10b-1a2ebb949646/flink-web-upload/b48844c7-d529-4377-a644-f5d12081b15a_code/window.py", line 306, in main\n result_source = window(\n File "/tmp/flink-web-5ad4fcf7-d307-40ce-b10b-1a2ebb949646/flink-web-upload/b48844c7-d529-4377-a644-f5d12081b15a_code/window.py", line 259, in window\n table_result_udaf = table_env.execute_sql(\n File "/opt/amazon/opt/python/pyflink.zip/pyflink/table/table_environment.py", line 828, in execute_sql\n File "/opt/amazon/opt/python/py4j-0.10.9.3-src.zip/py4j/java_gateway.py", line 1321, in call\n File "/opt/amazon/opt/python/pyflink.zip/pyflink/util/exceptions.py", line 158, in deco\npyflink.util.exceptions.TableException: org.apache.flink.table.api.TableException: Failed to execute sql\n\tat org.apache.flink.table.api.internal.TableEnvironmentImpl.executeInternal(TableEnvironmentImpl.java:821)\n\tat org.apache.flink.table.api.internal.TableEnvironmentImpl.executeInternal(TableEnvironmentImpl.java:784)\n\tat org.apache.flink.table.api.internal.TableEnvironmentImpl.executeInternal(TableEnvironmentImpl.java:861)\n\tat org.apache.flink.table.api.internal.TableEnvironmentImpl.executeSql(TableEnvironmentImpl.java:701)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)\n\tat org.apache.flink.api.python.shaded.py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)\n\tat org.apache.flink.api.python.shaded.py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)\n\tat org.apache.flink.api.python.shaded.py4j.Gateway.invoke(Gateway.java:282)\n\tat org.apache.flink.api.python.shaded.py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)\n\tat org.apache.flink.api.python.shaded.py4j.commands.CallCommand.execute(CallCommand.java:79)\n\tat org.apache.flink.api.python.shaded.py4j.GatewayConnection.run(GatewayConnection.java:238)\n\tat java.base/java.lang.Thread.run(Thread.java:829)\nCaused by: org.apache.flink.util.FlinkRuntimeException: Cannot have more than one execute() or executeAsync() call in a single environment.\n\tat org.apache.flink.client.program.StreamContextEnvironment.validateAllowedExecution(StreamContextEnvironment.java:199)\n\tat org.apache.flink.client.program.StreamContextEnvironment.executeAsync(StreamContextEnvironment.java:187)\n\tat org.apache.flink.table.planner.delegation.DefaultExecutor.executeAsync(DefaultExecutor.java:95)\n\tat org.apache.flink.table.executor.python.ChainingOptimizingExecutor.executeAsync(ChainingOptimizingExecutor.java:73)\n\tat org.apache.flink.table.api.internal.TableEnvironmentImpl.executeInternal(TableEnvironmentImpl.java:804)\n\t... 14 more\n\n",
"messageSchemaVersion": "1",
"messageType": "INFO",
"threadName": "Flink-DispatcherRestEndpoint-thread-1"
}
I guess I should be focusing on "FlinkRuntimeException: Cannot have more than one execute() or executeAsync() call in a single environment". I quickly skimmed my PyFlink application, and didn't notice any execute python commands. However, I do call table_env.execute_sql 6x. Am I only allowed to call execute_sql one time for my table_env environment? I also deployed this same PyFlink 1.15 application locally on PyCharm, reading from the same kinesis stream, and all was working as desired/expected.