You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "Shrividya (via GitHub)" <gi...@apache.org> on 2026/04/05 02:13:33 UTC
Re: [PR] [MINOR] Raise exception if no active Spark context [spark]
Shrividya commented on code in PR #54036:
URL: https://github.com/apache/spark/pull/54036#discussion_r3036295021
##########
python/pyspark/sql/functions/builtin.py:
##########
@@ -107,7 +107,8 @@ def _invoke_function(name: str, *args: Any) -> Column:
"""
from pyspark import SparkContext
- assert SparkContext._active_spark_context is not None
+ if SparkContext._active_spark_context is None:
+ raise PySparkException("No active Spark context.")
Review Comment:
nit : a message that says, "No active SparkContext. Please create a SparkContext before calling PySpark functions." would be more actionable for someone debugging this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org