You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Huaxin Gao (JIRA)" <ji...@apache.org> on 2018/04/23 22:40:00 UTC

[jira] [Updated] (SPARK-24057) put the real data type in the AssertionError message

     [ https://issues.apache.org/jira/browse/SPARK-24057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Huaxin Gao updated SPARK-24057:
-------------------------------
    Description: 
I had a wrong data type in one of my tests and got the following message: 

/spark/python/pyspark/sql/types.py", line 405, in __init__

assert isinstance(dataType, DataType), "dataType should be DataType"

AssertionError: dataType should be DataType

I checked types.py,  line 405, in __init__, it has

{{assert isinstance(dataType, DataType), "dataType should be DataType"}}

I think it meant to be 

{{assert isinstance(dataType, DataType), "%s should be %s"  % (dataType, DataType)}}

so the error message will be something like 

{{AssertionError: <type 'long'> should be <class 'pyspark.sql.types.DataType'>}}

There are a couple of other places that have the same problem. 

  was:
I had a wrong data type in one of my tests and got the following message: 

/spark/python/pyspark/sql/types.py", line 405, in __init__

        assert isinstance(dataType, DataType), "dataType should be DataType"

    AssertionError: dataType should be DataType

 

I checked types.py,  line 405, in __init__, it has

assert isinstance(dataType, DataType), "dataType should be DataType"

I think it meant to be 

assert isinstance(dataType, DataType), "%s should be %s"  % (dataType, DataType)

so the error message will be something like 

AssertionError: <type 'long'> should be <class 'pyspark.sql.types.DataType'>

There are a couple of other places that have the same problem. 


> put the real data type in the AssertionError message
> ----------------------------------------------------
>
>                 Key: SPARK-24057
>                 URL: https://issues.apache.org/jira/browse/SPARK-24057
>             Project: Spark
>          Issue Type: Bug
>          Components: PySpark
>    Affects Versions: 2.3.0
>            Reporter: Huaxin Gao
>            Priority: Minor
>
> I had a wrong data type in one of my tests and got the following message: 
> /spark/python/pyspark/sql/types.py", line 405, in __init__
> assert isinstance(dataType, DataType), "dataType should be DataType"
> AssertionError: dataType should be DataType
> I checked types.py,  line 405, in __init__, it has
> {{assert isinstance(dataType, DataType), "dataType should be DataType"}}
> I think it meant to be 
> {{assert isinstance(dataType, DataType), "%s should be %s"  % (dataType, DataType)}}
> so the error message will be something like 
> {{AssertionError: <type 'long'> should be <class 'pyspark.sql.types.DataType'>}}
> There are a couple of other places that have the same problem. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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