itholic opened a new pull request, #40458:
URL: https://github.com/apache/spark/pull/40458

   ### What changes were proposed in this pull request?
   
   This pull request proposes an improvement to the error message when trying 
to access a JVM attribute that is not supported in Spark Connect. Specifically, 
it adds a more informative error message that clearly indicates which attribute 
is not supported due to Spark Connect's lack of dependency on the JVM.
   
   ### Why are the changes needed?
   
   Currently, when attempting to access an unsupported JVM attribute in Spark 
Connect, the error message is not very clear, making it difficult for users to 
understand the root cause of the issue. This improvement aims to provide more 
helpful information to users to address this problem as below:
   
   **Before**
   ```python
   >>> spark._jsc
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
   AttributeError: 'SparkSession' object has no attribute '_jsc'
   ```
   
   **After**
   ```python
   >>> spark._jsc
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File 
"/Users/haejoon.lee/Desktop/git_store/spark/python/pyspark/sql/connect/session.py",
 line 490, in _jsc
       raise PySparkAttributeError(
   pyspark.errors.exceptions.base.PySparkAttributeError: 
[JVM_ATTRIBUTE_NOT_SUPPORTED] Attribute `_jsc` is not supported in Spark 
Connect as it depends on the JVM.
   ```
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   This PR does not introduce any user-facing change in terms of functionality. 
However, it improves the error message, which could potentially affect the user 
experience in a positive way.
   
   ### How was this patch tested?
   
   This patch was tested by adding new unit tests that specifically target the 
error message related to unsupported JVM attributes. The tests were run locally 
on a development environment.


-- 
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