HyukjinKwon commented on code in PR #39041:
URL: https://github.com/apache/spark/pull/39041#discussion_r1051831436


##########
python/pyspark/sql/utils.py:
##########
@@ -307,3 +311,52 @@ def is_timestamp_ntz_preferred() -> bool:
     """
     jvm = SparkContext._jvm
     return jvm is not None and jvm.PythonSQLUtils.isTimestampNTZPreferred()
+
+
+def is_remote() -> bool:
+    """
+    Returns if the current running environment is for Spark Connect.
+    """
+    return "SPARK_REMOTE" in os.environ
+
+
+def try_remote_functions(f: FuncT) -> FuncT:

Review Comment:
   It cannot do because the import can be done first before Spark session 
initialization. We are only able to know if we're using the remove or not when 
Spark session is initialized. e.g.,
   
   ```python
   from pyspark.sql.functions import lit
   from pyspark.sql import SparkSession
   
   SparkSession.builder.getOrCreate()  # we can know if this is remote or not 
from here.
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to