[jira] [Commented] (SPARK-19507) pyspark.sql.types._verify_type() exceptions too broad to debug collections or nested data

2017-07-03 Thread Apache Spark (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-19507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16073000#comment-16073000
 ] 

Apache Spark commented on SPARK-19507:
--

User 'HyukjinKwon' has created a pull request for this issue:
https://github.com/apache/spark/pull/18521

> pyspark.sql.types._verify_type() exceptions too broad to debug collections or 
> nested data
> -
>
> Key: SPARK-19507
> URL: https://issues.apache.org/jira/browse/SPARK-19507
> Project: Spark
>  Issue Type: New Feature
>  Components: PySpark
>Affects Versions: 2.1.0
> Environment: macOS Sierra 10.12.3
> Spark 2.1.0, installed via Homebrew
>Reporter: David Gingrich
>Priority: Trivial
>
> The private function pyspark.sql.types._verify_type() recursively checks an 
> object against a datatype, raising an exception if the object does not 
> satisfy the type.  These messages are not specific enough to debug a data 
> error in a collection or nested data, for instance:
> {quote}
> >>> import pyspark.sql.types as typ
> >>> schema = typ.StructType([typ.StructField('nest1', 
> >>> typ.MapType(typ.StringType(), typ.ArrayType(typ.FloatType(])
> >>> typ._verify_type({'nest1': {'nest2': [1]}}, schema)
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1355, in 
> _verify_type
> _verify_type(obj.get(f.name), f.dataType, f.nullable, name=new_name)
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1349, in 
> _verify_type
> _verify_type(v, dataType.valueType, dataType.valueContainsNull, 
> name=new_name)
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1342, in 
> _verify_type
> _verify_type(i, dataType.elementType, dataType.containsNull, 
> name=new_name)
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1325, in 
> _verify_type
> % (name, dataType, obj, type(obj)))
> TypeError: FloatType can not accept object 1 in type 
> {quote}
> Passing and printing a field name would make debugging easier.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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



[jira] [Commented] (SPARK-19507) pyspark.sql.types._verify_type() exceptions too broad to debug collections or nested data

2017-03-09 Thread Apache Spark (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-19507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15903680#comment-15903680
 ] 

Apache Spark commented on SPARK-19507:
--

User 'dgingrich' has created a pull request for this issue:
https://github.com/apache/spark/pull/17227

> pyspark.sql.types._verify_type() exceptions too broad to debug collections or 
> nested data
> -
>
> Key: SPARK-19507
> URL: https://issues.apache.org/jira/browse/SPARK-19507
> Project: Spark
>  Issue Type: New Feature
>  Components: PySpark
>Affects Versions: 2.1.0
> Environment: macOS Sierra 10.12.3
> Spark 2.1.0, installed via Homebrew
>Reporter: David Gingrich
>Priority: Trivial
>
> The private function pyspark.sql.types._verify_type() recursively checks an 
> object against a datatype, raising an exception if the object does not 
> satisfy the type.  These messages are not specific enough to debug a data 
> error in a collection or nested data, for instance:
> {quote}
> >>> import pyspark.sql.types as typ
> >>> schema = typ.StructType([typ.StructField('nest1', 
> >>> typ.MapType(typ.StringType(), typ.ArrayType(typ.FloatType(])
> >>> typ._verify_type({'nest1': {'nest2': [1]}}, schema)
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1355, in 
> _verify_type
> _verify_type(obj.get(f.name), f.dataType, f.nullable, name=new_name)
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1349, in 
> _verify_type
> _verify_type(v, dataType.valueType, dataType.valueContainsNull, 
> name=new_name)
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1342, in 
> _verify_type
> _verify_type(i, dataType.elementType, dataType.containsNull, 
> name=new_name)
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1325, in 
> _verify_type
> % (name, dataType, obj, type(obj)))
> TypeError: FloatType can not accept object 1 in type 
> {quote}
> Passing and printing a field name would make debugging easier.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Commented] (SPARK-19507) pyspark.sql.types._verify_type() exceptions too broad to debug collections or nested data

2017-02-08 Thread David Gingrich (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-19507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15858565#comment-15858565
 ] 

David Gingrich commented on SPARK-19507:


I'd advocate that it be made public, but I was saving that for a separate 
discussion sine it's a bigger change :)

{{_verfy_type}} is called from {{pyspark.sql.session.createDataFrame}} if 
{{verifySchema is True}}, so better debug messages would help that usecase.

I think the main reason to add it is that otherwise the output isn't useful for 
debugging.  The change is also simple (adding a {{name}} parameter that is used 
in the exception messages and augmented for recursive calls.  I have a patch 
but I wanted to add tests before submitting the PR.

> pyspark.sql.types._verify_type() exceptions too broad to debug collections or 
> nested data
> -
>
> Key: SPARK-19507
> URL: https://issues.apache.org/jira/browse/SPARK-19507
> Project: Spark
>  Issue Type: New Feature
>  Components: PySpark
>Affects Versions: 2.1.0
> Environment: macOS Sierra 10.12.3
> Spark 2.1.0, installed via Homebrew
>Reporter: David Gingrich
>Priority: Trivial
>
> The private function pyspark.sql.types._verify_type() recursively checks an 
> object against a datatype, raising an exception if the object does not 
> satisfy the type.  These messages are not specific enough to debug a data 
> error in a collection or nested data, for instance:
> {quote}
> >>> import pyspark.sql.types as typ
> >>> schema = typ.StructType([typ.StructField('nest1', 
> >>> typ.MapType(typ.StringType(), typ.ArrayType(typ.FloatType(])
> >>> typ._verify_type({'nest1': {'nest2': [1]}}, schema)
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1355, in 
> _verify_type
> _verify_type(obj.get(f.name), f.dataType, f.nullable, name=new_name)
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1349, in 
> _verify_type
> _verify_type(v, dataType.valueType, dataType.valueContainsNull, 
> name=new_name)
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1342, in 
> _verify_type
> _verify_type(i, dataType.elementType, dataType.containsNull, 
> name=new_name)
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1325, in 
> _verify_type
> % (name, dataType, obj, type(obj)))
> TypeError: FloatType can not accept object 1 in type 
> {quote}
> Passing and printing a field name would make debugging easier.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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



[jira] [Commented] (SPARK-19507) pyspark.sql.types._verify_type() exceptions too broad to debug collections or nested data

2017-02-07 Thread Hyukjin Kwon (JIRA)

[ 
https://issues.apache.org/jira/browse/SPARK-19507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15857423#comment-15857423
 ] 

Hyukjin Kwon commented on SPARK-19507:
--

That is as you said private with the underbar prefix according to pep8, which 
is not meant to be called as an API.

I assume it affects an user-faced message when we use create a dataframe via 
PySpark. Could you leave some more example/explanation when users face this 
message?

> pyspark.sql.types._verify_type() exceptions too broad to debug collections or 
> nested data
> -
>
> Key: SPARK-19507
> URL: https://issues.apache.org/jira/browse/SPARK-19507
> Project: Spark
>  Issue Type: New Feature
>  Components: PySpark
>Affects Versions: 2.1.0
> Environment: macOS Sierra 10.12.3
> Spark 2.1.0, installed via Homebrew
>Reporter: David Gingrich
>Priority: Trivial
>
> The private function pyspark.sql.types._verify_type() recursively checks an 
> object against a datatype, raising an exception if the object does not 
> satisfy the type.  These messages are not specific enough to debug a data 
> error in a collection or nested data, for instance:
> {quote}
> >>> import pyspark.sql.types as typ
> >>> schema = typ.StructType([typ.StructField('nest1', 
> >>> typ.MapType(typ.StringType(), typ.ArrayType(typ.FloatType(])
> >>> typ._verify_type({'nest1': {'nest2': [1]}}, schema)
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1355, in 
> _verify_type
> _verify_type(obj.get(f.name), f.dataType, f.nullable, name=new_name)
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1349, in 
> _verify_type
> _verify_type(v, dataType.valueType, dataType.valueContainsNull, 
> name=new_name)
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1342, in 
> _verify_type
> _verify_type(i, dataType.elementType, dataType.containsNull, 
> name=new_name)
>   File "/Users/david/src/3p/spark/python/pyspark/sql/types.py", line 1325, in 
> _verify_type
> % (name, dataType, obj, type(obj)))
> TypeError: FloatType can not accept object 1 in type 
> {quote}
> Passing and printing a field name would make debugging easier.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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