You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "xinrong-meng (via GitHub)" <gi...@apache.org> on 2024/10/30 03:14:30 UTC

[PR] [SPARK-50167][PYTHON][CONNECT] Improve PySpark plotting error messages and imports [spark]

xinrong-meng opened a new pull request, #48701:
URL: https://github.com/apache/spark/pull/48701

   ### What changes were proposed in this pull request?
   Improve PySpark plotting error messages and imports:
   - Minor improvements to error messages for better clarity.
   - Delayed imports of PySparkPlotAccessor as a best practice to avoid potential circular imports in the future.
   
   ### Why are the changes needed?
   Improving error messages enhances usability, while delaying PySparkPlotAccessor imports prevents potential circular dependencies.
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   ### How was this patch tested?
   Unit tests.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No.


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


Re: [PR] [SPARK-50167][PYTHON][CONNECT] Improve PySpark plotting error messages and imports [spark]

Posted by "xinrong-meng (via GitHub)" <gi...@apache.org>.
xinrong-meng commented on code in PR #48701:
URL: https://github.com/apache/spark/pull/48701#discussion_r1821964167


##########
python/pyspark/errors/error-conditions.json:
##########
@@ -817,12 +817,12 @@
       "Pipe function `<func_name>` exited with error code <error_code>."
     ]
   },
-    "PLOT_INVALID_TYPE_COLUMN": {
+  "PLOT_INVALID_TYPE_COLUMN": {
     "message": [
       "Column <col_name> must be one of <valid_types> for plotting, got <col_type>."
     ]
   },
-  "PLOT_NOT_NUMERIC_COLUMN": {

Review Comment:
   PLOT_NOT_NUMERIC_COLUMN_ARGUMENT focuses on **argument** must be numeric.
   PLOT_INVALID_TYPE_COLUMN indicates that a specific **column** must be of a valid type.
   How about we keep both for clarity?



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


Re: [PR] [SPARK-50167][PYTHON][CONNECT] Improve PySpark plotting error messages and imports [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk closed pull request #48701: [SPARK-50167][PYTHON][CONNECT] Improve PySpark plotting error messages and imports
URL: https://github.com/apache/spark/pull/48701


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


Re: [PR] [SPARK-50167][PYTHON][CONNECT] Improve PySpark plotting error messages and imports [spark]

Posted by "MaxGekk (via GitHub)" <gi...@apache.org>.
MaxGekk commented on PR #48701:
URL: https://github.com/apache/spark/pull/48701#issuecomment-2447715785

   +1, LGTM. Merging to master.
   Thank you, @xinrong-meng and @zhengruifeng for review.


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


Re: [PR] [SPARK-50167][PYTHON][CONNECT] Improve PySpark plotting error messages and imports [spark]

Posted by "xinrong-meng (via GitHub)" <gi...@apache.org>.
xinrong-meng commented on code in PR #48701:
URL: https://github.com/apache/spark/pull/48701#discussion_r1821954065


##########
python/pyspark/sql/classic/dataframe.py:
##########
@@ -1795,7 +1791,9 @@ def executionInfo(self) -> Optional["ExecutionInfo"]:
         )
 
     @property
-    def plot(self) -> PySparkPlotAccessor:
+    def plot(self) -> "PySparkPlotAccessor":

Review Comment:
   Good catch! Thanks :)



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


Re: [PR] [SPARK-50167][PYTHON][CONNECT] Improve PySpark plotting error messages and imports [spark]

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on code in PR #48701:
URL: https://github.com/apache/spark/pull/48701#discussion_r1821812605


##########
python/pyspark/sql/classic/dataframe.py:
##########
@@ -1795,7 +1791,9 @@ def executionInfo(self) -> Optional["ExecutionInfo"]:
         )
 
     @property
-    def plot(self) -> PySparkPlotAccessor:
+    def plot(self) -> "PySparkPlotAccessor":

Review Comment:
   nit: we may need `# type: ignore[name-defined] # noqa: F821` :)



##########
python/pyspark/errors/error-conditions.json:
##########
@@ -817,12 +817,12 @@
       "Pipe function `<func_name>` exited with error code <error_code>."
     ]
   },
-    "PLOT_INVALID_TYPE_COLUMN": {
+  "PLOT_INVALID_TYPE_COLUMN": {
     "message": [
       "Column <col_name> must be one of <valid_types> for plotting, got <col_type>."
     ]
   },
-  "PLOT_NOT_NUMERIC_COLUMN": {

Review Comment:
   nit, can we combine this error class and the above one?



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


Re: [PR] [SPARK-50167][PYTHON][CONNECT] Improve PySpark plotting error messages and imports [spark]

Posted by "xinrong-meng (via GitHub)" <gi...@apache.org>.
xinrong-meng commented on PR #48701:
URL: https://github.com/apache/spark/pull/48701#issuecomment-2448744146

   Thank you @MaxGekk ! : )


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