Juntao Hu created FLINK-30981:
---------------------------------

             Summary: explain_sql throws java method not exist
                 Key: FLINK-30981
                 URL: https://issues.apache.org/jira/browse/FLINK-30981
             Project: Flink
          Issue Type: Bug
          Components: API / Python
    Affects Versions: 1.17.0
            Reporter: Juntao Hu
             Fix For: 1.17.0, 1.18.0


Execute `t_env.explainSql("ANY VALID SQL")` will throw error:
{code:java}
Traceback (most recent call last):
  File "ISSUE/FLINK-25622.py", line 42, in <module>
    main()
  File "ISSUE/FLINK-25622.py", line 34, in main
    print(t_env.explain_sql(
  File 
"/Users/vancior/Documents/Github/flink-back/flink-python/pyflink/table/table_environment.py",
 line 799, in explain_sql
    return self._j_tenv.explainSql(stmt, j_extra_details)
  File 
"/Users/vancior/miniconda3/envs/flink-python/lib/python3.8/site-packages/py4j/java_gateway.py",
 line 1322, in __call__
    return_value = get_return_value(
  File 
"/Users/vancior/Documents/Github/flink-back/flink-python/pyflink/util/exceptions.py",
 line 146, in deco
    return f(*a, **kw)
  File 
"/Users/vancior/miniconda3/envs/flink-python/lib/python3.8/site-packages/py4j/protocol.py",
 line 330, in get_return_value
    raise Py4JError(
py4j.protocol.Py4JError: An error occurred while calling o11.explainSql. Trace:
org.apache.flink.api.python.shaded.py4j.Py4JException: Method explainSql([class 
java.lang.String, class [Lorg.apache.flink.table.api.ExplainDetail;]) 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(Thread.java:829) {code}
#30668 changed TableEnvironment#explainSql to an interface default method, 
while both TableEnvironmentInternal and TableEnvironmentImpl not overwriting 
it, it triggers a bug in py4j, see [https://github.com/py4j/py4j/issues/506] .



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

Reply via email to