Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-35176

Raise TypeError in inappropriate type case rather than ValueError

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.2.0
    • 3.2.0
    • PySpark
    • None

    Description

      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

      Attachments

        Activity

          People

            yikunkero Yikun Jiang
            yikunkero Yikun Jiang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: