forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-47069][PYTHON][CONNECT] Introduce
spark.profile.show/dump
fo…
…r SparkSession-based profiling ### What changes were proposed in this pull request? Introduce `spark.profile.show/dump` for SparkSession-based profiling for non-Spark-Connect. ### Why are the changes needed? SparkContext-based profiling has `sc.dump_profiles/show_profiles` for both perf and memory profiling. Currently SparkSession-based has `spark.dump/showPerfProfiles` and `spark.dump/showMemoryProfiles` for perf and memory profiling separately. It would be more consistent and user-friendly to consolidate them to a uniform interface as `spark.profile.dump/show`. ### Does this PR introduce _any_ user-facing change? Yes. `spark.profile.show/dump` is supported, whereas (not-released yet) APIs below are removed -`spark.dumpPerfProfiles` -`spark.dumpMemoryProfiles` -`spark.showPerfProfiles` -`spark.showMemoryProfiles` ```py >>> spark.conf.set("spark.sql.pyspark.udf.profiler", "perf") # enable cProfiler >>> >>> udf("string") ... def f(x): ... return str(x) ... >>> df = spark.range(10).select(f(col("id"))) >>> df.collect() [Row(f(id)='0'), ...] >>> spark.profile.show() ============================================================ Profile of UDF<id=2> ============================================================ ... >>> spark.profile.show(type="memory") >>> spark.profile.show(type="perf") ============================================================ Profile of UDF<id=2> ============================================================ ... >>> spark.profile.show(2, type="perf") ============================================================ Profile of UDF<id=2> ============================================================ ... >>> spark.profile.show(2, type="memory") ``` ### How was this patch tested? Unit tests. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#45129 from xinrong-meng/spark.profile. Authored-by: Xinrong Meng <[email protected]> Signed-off-by: Takuya UESHIN <[email protected]>
- Loading branch information
1 parent
6185e5c
commit 9debaea
Showing
8 changed files
with
171 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.