pyspark 中无法调用 explain analyze?

如图,在pyspark中可以调用explain,但explain analyze不行。是pyspark有什么限制么?

>>> spark.sql("explain analyze select * from test.t1").collect()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/shawnyan/spark-3.3.1-bin-hadoop2/python/pyspark/sql/session.py", line 1034, in sql
    return DataFrame(self._jsparkSession.sql(sqlQuery), self)
  File "/home/shawnyan/spark-3.3.1-bin-hadoop2/python/lib/py4j-0.10.9.5-src.zip/py4j/java_gateway.py", line 1322, in __call__
  File "/home/shawnyan/spark-3.3.1-bin-hadoop2/python/pyspark/sql/utils.py", line 196, in deco
    raise converted from None
pyspark.sql.utils.ParseException:
Syntax error at or near 'select'(line 1, pos 16)

== SQL ==
explain analyze select * from test.t1
----------------^^^

试一下 spark.sql(“explain select * from test.t1”)
或者 spark.sql(“explain cost select * from test.t1”)
这个是spark 的 sql 不是 tidb的sql语法不一样
spark.sql(“explain select * from test.t1”)
https://spark.apache.org/docs/latest/sql-ref-syntax-qry-explain.html

yes, also add comment in the blog.

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。