You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yikun Jiang (Jira)" <ji...@apache.org> on 2021/04/21 14:48:00 UTC

[jira] [Created] (SPARK-35176) Raise TypeError in inappropriate type case rather than ValueError

Yikun Jiang created SPARK-35176:
-----------------------------------

             Summary:  Raise TypeError in inappropriate type case rather than ValueError
                 Key: SPARK-35176
                 URL: https://issues.apache.org/jira/browse/SPARK-35176
             Project: Spark
          Issue Type: Bug
          Components: PySpark
    Affects Versions: 3.2.0
            Reporter: Yikun Jiang


There are many wrong error type usages on ValueError type.

When an operation or function is applied to an object of inappropriate type, we should use TypeError rather than ValueError.

such as:

[https://github.com/apache/spark/blob/355c39939d9e4c87ffc9538eb822a41cb2ff93fb/python/pyspark/sql/dataframe.py#L1137]

[https://github.com/apache/spark/blob/355c39939d9e4c87ffc9538eb822a41cb2ff93fb/python/pyspark/sql/dataframe.py#L1228]

 

We should do some correction in some right time, note that if we do these corrections, it will break some catch on original ValueError.

 

[1] https://docs.python.org/3/library/exceptions.html#TypeError



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org