[jira] [Commented] (SPARK-19732) DataFrame.fillna() does not work for bools in PySpark

2017-04-20 Thread Len Frodgers (JIRA)

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

Len Frodgers commented on SPARK-19732:
--

Thanks. Have updated

> DataFrame.fillna() does not work for bools in PySpark
> -
>
> Key: SPARK-19732
> URL: https://issues.apache.org/jira/browse/SPARK-19732
> Project: Spark
>  Issue Type: Improvement
>  Components: PySpark
>Affects Versions: 2.1.0
>Reporter: Len Frodgers
>Priority: Minor
>
> In PySpark, the fillna function of DataFrame inadvertently casts bools to 
> ints, so fillna cannot be used to fill True/False.
> e.g. 
> `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
> yields
> `[Row(a=True), Row(a=None)]`
> It should be a=True for the second Row
> The cause is this bit of code: 
> {code}
> if isinstance(value, (int, long)):
> value = float(value)
> {code}
> There needs to be a separate check for isinstance(bool), since in python, 
> bools are ints too
> Additionally there's another anomaly:
> Spark (and pyspark) supports filling of bools if you specify the args as a 
> map: 
> {code}
> fillna({"a": False})
> {code}
> , but not if you specify it as
> {code}
> fillna(False)
> {code}
> This is because (scala-)Spark has no
> {code}
> def fill(value: Boolean): DataFrame = fill(value, df.columns)
> {code}
>  method. I find that strange/buggy



--
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] [Issue Comment Deleted] (SPARK-19732) DataFrame.fillna() does not work for bools in PySpark

2017-04-20 Thread Len Frodgers (JIRA)

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

Len Frodgers updated SPARK-19732:
-
Comment: was deleted

(was: Actually there's another anomaly:
Spark (and pyspark) supports filling of bools if you specify the args as a map: 
{code}
fillna({"a": False})
{code}
, but not if you specify it as
{code}
fillna(False)
{code}

This is because (scala-)Spark has no
{code}
def fill(value: Boolean): DataFrame = fill(value, df.columns)
{code}
 method. I find that strange/buggy)

> DataFrame.fillna() does not work for bools in PySpark
> -
>
> Key: SPARK-19732
> URL: https://issues.apache.org/jira/browse/SPARK-19732
> Project: Spark
>  Issue Type: Improvement
>  Components: PySpark
>Affects Versions: 2.1.0
>Reporter: Len Frodgers
>Priority: Minor
>
> In PySpark, the fillna function of DataFrame inadvertently casts bools to 
> ints, so fillna cannot be used to fill True/False.
> e.g. 
> `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
> yields
> `[Row(a=True), Row(a=None)]`
> It should be a=True for the second Row
> The cause is this bit of code: 
> {code}
> if isinstance(value, (int, long)):
> value = float(value)
> {code}
> There needs to be a separate check for isinstance(bool), since in python, 
> bools are ints too
> Additionally there's another anomaly:
> Spark (and pyspark) supports filling of bools if you specify the args as a 
> map: 
> {code}
> fillna({"a": False})
> {code}
> , but not if you specify it as
> {code}
> fillna(False)
> {code}
> This is because (scala-)Spark has no
> {code}
> def fill(value: Boolean): DataFrame = fill(value, df.columns)
> {code}
>  method. I find that strange/buggy



--
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] [Updated] (SPARK-19732) DataFrame.fillna() does not work for bools in PySpark

2017-04-20 Thread Len Frodgers (JIRA)

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

Len Frodgers updated SPARK-19732:
-
Description: 
In PySpark, the fillna function of DataFrame inadvertently casts bools to ints, 
so fillna cannot be used to fill True/False.

e.g. `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
yields
`[Row(a=True), Row(a=None)]`
It should be a=True for the second Row

The cause is this bit of code: 
{code}
if isinstance(value, (int, long)):
value = float(value)
{code}
There needs to be a separate check for isinstance(bool), since in python, bools 
are ints too

Additionally there's another anomaly:
Spark (and pyspark) supports filling of bools if you specify the args as a map: 
{code}
fillna({"a": False})
{code}
, but not if you specify it as
{code}
fillna(False)
{code}

This is because (scala-)Spark has no
{code}
def fill(value: Boolean): DataFrame = fill(value, df.columns)
{code}
 method. I find that strange/buggy

  was:
In PySpark, the fillna function of DataFrame inadvertently casts bools to ints, 
so fillna cannot be used to fill True/False.

e.g. `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
yields
`[Row(a=True), Row(a=None)]`
It should be a=True for the second Row

The cause is this bit of code: 
{code}
if isinstance(value, (int, long)):
value = float(value)
{code}

There needs to be a separate check for isinstance(bool), since in python, bools 
are ints too


> DataFrame.fillna() does not work for bools in PySpark
> -
>
> Key: SPARK-19732
> URL: https://issues.apache.org/jira/browse/SPARK-19732
> Project: Spark
>  Issue Type: Improvement
>  Components: PySpark
>Affects Versions: 2.1.0
>Reporter: Len Frodgers
>Priority: Minor
>
> In PySpark, the fillna function of DataFrame inadvertently casts bools to 
> ints, so fillna cannot be used to fill True/False.
> e.g. 
> `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
> yields
> `[Row(a=True), Row(a=None)]`
> It should be a=True for the second Row
> The cause is this bit of code: 
> {code}
> if isinstance(value, (int, long)):
> value = float(value)
> {code}
> There needs to be a separate check for isinstance(bool), since in python, 
> bools are ints too
> Additionally there's another anomaly:
> Spark (and pyspark) supports filling of bools if you specify the args as a 
> map: 
> {code}
> fillna({"a": False})
> {code}
> , but not if you specify it as
> {code}
> fillna(False)
> {code}
> This is because (scala-)Spark has no
> {code}
> def fill(value: Boolean): DataFrame = fill(value, df.columns)
> {code}
>  method. I find that strange/buggy



--
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] [Updated] (SPARK-19732) DataFrame.fillna() does not work for bools in PySpark

2017-04-20 Thread Len Frodgers (JIRA)

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

Len Frodgers updated SPARK-19732:
-
Issue Type: Improvement  (was: Bug)

> DataFrame.fillna() does not work for bools in PySpark
> -
>
> Key: SPARK-19732
> URL: https://issues.apache.org/jira/browse/SPARK-19732
> Project: Spark
>  Issue Type: Improvement
>  Components: PySpark
>Affects Versions: 2.1.0
>Reporter: Len Frodgers
>
> In PySpark, the fillna function of DataFrame inadvertently casts bools to 
> ints, so fillna cannot be used to fill True/False.
> e.g. 
> `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
> yields
> `[Row(a=True), Row(a=None)]`
> It should be a=True for the second Row
> The cause is this bit of code: 
> {code}
> if isinstance(value, (int, long)):
> value = float(value)
> {code}
> There needs to be a separate check for isinstance(bool), since in python, 
> bools are ints too



--
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] [Updated] (SPARK-19732) DataFrame.fillna() does not work for bools in PySpark

2017-04-20 Thread Len Frodgers (JIRA)

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

Len Frodgers updated SPARK-19732:
-
Priority: Minor  (was: Major)

> DataFrame.fillna() does not work for bools in PySpark
> -
>
> Key: SPARK-19732
> URL: https://issues.apache.org/jira/browse/SPARK-19732
> Project: Spark
>  Issue Type: Improvement
>  Components: PySpark
>Affects Versions: 2.1.0
>Reporter: Len Frodgers
>Priority: Minor
>
> In PySpark, the fillna function of DataFrame inadvertently casts bools to 
> ints, so fillna cannot be used to fill True/False.
> e.g. 
> `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
> yields
> `[Row(a=True), Row(a=None)]`
> It should be a=True for the second Row
> The cause is this bit of code: 
> {code}
> if isinstance(value, (int, long)):
> value = float(value)
> {code}
> There needs to be a separate check for isinstance(bool), since in python, 
> bools are ints too



--
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-19871) Improve error message in verify_type to indicate which field the error is for

2017-03-08 Thread Len Frodgers (JIRA)

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

Len Frodgers commented on SPARK-19871:
--

https://github.com/apache/spark/pull/17213

> Improve error message in verify_type to indicate which field the error is for
> -
>
> Key: SPARK-19871
> URL: https://issues.apache.org/jira/browse/SPARK-19871
> Project: Spark
>  Issue Type: Bug
>  Components: PySpark, SQL
>Affects Versions: 2.0.2, 2.1.0
>Reporter: Len Frodgers
>
> The error message for _verify_type is too vague. It should specify for which 
> field the type verification failed.
> e.g. error: "This field is not nullable, but got None" – but what is the 
> field?!
> In a dataframe with many non-nullable fields, it is a nightmare trying to 
> hunt down which field is null, since one has to resort to basic (and very 
> slow) trial and error.
> I have happily created a PR to fix this.



--
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-13740) add null check for _verify_type in types.py

2017-03-08 Thread Len Frodgers (JIRA)

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

Len Frodgers commented on SPARK-13740:
--

https://github.com/apache/spark/pull/17213

> add null check for _verify_type in types.py
> ---
>
> Key: SPARK-13740
> URL: https://issues.apache.org/jira/browse/SPARK-13740
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Reporter: Wenchen Fan
>Assignee: Wenchen Fan
> Fix For: 2.0.0
>
>




--
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] [Created] (SPARK-19871) Improve error message in verify_type to indicate which field the error is for

2017-03-08 Thread Len Frodgers (JIRA)
Len Frodgers created SPARK-19871:


 Summary: Improve error message in verify_type to indicate which 
field the error is for
 Key: SPARK-19871
 URL: https://issues.apache.org/jira/browse/SPARK-19871
 Project: Spark
  Issue Type: Bug
  Components: PySpark, SQL
Affects Versions: 2.1.0, 2.0.2
Reporter: Len Frodgers


The error message for _verify_type is too vague. It should specify for which 
field the type verification failed.

e.g. error: "This field is not nullable, but got None" – but what is the field?!

In a dataframe with many non-nullable fields, it is a nightmare trying to hunt 
down which field is null, since one has to resort to basic (and very slow) 
trial and error.

I have happily created a PR to fix this.



--
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-13740) add null check for _verify_type in types.py

2017-03-08 Thread Len Frodgers (JIRA)

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

Len Frodgers commented on SPARK-13740:
--

Thanks for the fix, but IMO the error message is so poor as to render this fix 
worse than the original behaviour.

Error: "This field is not nullable, but got None" -- but what is the field?!

In a dataframe with many non-nullable fields, it is a nightmare trying to hunt 
down which field is null, since one has to resort to basic (and very slow) 
trial and error.

I will happily create a PR to fix this.

Let me know if I should create a new issue for this.

> add null check for _verify_type in types.py
> ---
>
> Key: SPARK-13740
> URL: https://issues.apache.org/jira/browse/SPARK-13740
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Reporter: Wenchen Fan
>Assignee: Wenchen Fan
> Fix For: 2.0.0
>
>




--
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] [Comment Edited] (SPARK-19732) DataFrame.fillna() does not work for bools in PySpark

2017-02-24 Thread Len Frodgers (JIRA)

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

Len Frodgers edited comment on SPARK-19732 at 2/24/17 9:12 PM:
---

Actually there's another anomaly:
Spark (and pyspark) supports filling of bools if you specify the args as a map: 
{code}
fillna({"a": False})
{code}
, but not if you specify it as
{code}
fillna(False)
{code}

This is because (scala-)Spark has no
{code}
def fill(value: Boolean): DataFrame = fill(value, df.columns)
{code}
 method. I find that strange/buggy


was (Author: lenfrodge):
Actually there's another anomaly:
Spark (and pyspark) supports filling of bools if you specify the args as a map: 
fillna({"a": False}) , but not if you specify it as fillna(False)

This is because (scala-)Spark has no `def fill(value: Booloean): DataFrame = 
fill(value, df.columns)` method. I find that strange/buggy

> DataFrame.fillna() does not work for bools in PySpark
> -
>
> Key: SPARK-19732
> URL: https://issues.apache.org/jira/browse/SPARK-19732
> Project: Spark
>  Issue Type: Bug
>  Components: PySpark
>Affects Versions: 2.1.0
>Reporter: Len Frodgers
>
> In PySpark, the fillna function of DataFrame inadvertently casts bools to 
> ints, so fillna cannot be used to fill True/False.
> e.g. 
> `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
> yields
> `[Row(a=True), Row(a=None)]`
> It should be a=True for the second Row
> The cause is this bit of code: 
> {code}
> if isinstance(value, (int, long)):
> value = float(value)
> {code}
> There needs to be a separate check for isinstance(bool), since in python, 
> bools are ints too



--
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-19732) DataFrame.fillna() does not work for bools in PySpark

2017-02-24 Thread Len Frodgers (JIRA)

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

Len Frodgers commented on SPARK-19732:
--

Actually there's another anomaly:
Spark (and pyspark) supports filling of bools if you specify the args as a map: 
fillna({"a": False}) , but not if you specify it as fillna(False)

This is because (scala-)Spark has no `def fill(value: Booloean): DataFrame = 
fill(value, df.columns)` method. I find that strange/buggy

> DataFrame.fillna() does not work for bools in PySpark
> -
>
> Key: SPARK-19732
> URL: https://issues.apache.org/jira/browse/SPARK-19732
> Project: Spark
>  Issue Type: Bug
>  Components: PySpark
>Affects Versions: 2.1.0
>Reporter: Len Frodgers
>
> In PySpark, the fillna function of DataFrame inadvertently casts bools to 
> ints, so fillna cannot be used to fill True/False.
> e.g. 
> `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
> yields
> `[Row(a=True), Row(a=None)]`
> It should be a=True for the second Row
> The cause is this bit of code: 
> {code}
> if isinstance(value, (int, long)):
> value = float(value)
> {code}
> There needs to be a separate check for isinstance(bool), since in python, 
> bools are ints too



--
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] [Updated] (SPARK-19732) DataFrame.fillna() does not work for bools in PySpark

2017-02-24 Thread Len Frodgers (JIRA)

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

Len Frodgers updated SPARK-19732:
-
Description: 
In PySpark, the fillna function of DataFrame inadvertently casts bools to ints, 
so fillna cannot be used to fill True/False.

e.g. `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
yields
`[Row(a=True), Row(a=None)]`
It should be a=True for the second Row

The cause is this bit of code: 
{code}
if isinstance(value, (int, long)):
value = float(value)
{code}

There needs to be a separate check for isinstance(bool), since in python, bools 
are ints too

  was:
In PySpark, the fillna function of DataFrame inadvertently casts bools to ints, 
so fillna cannot be used to fill True/False.

e.g. `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
yields
`[Row(a=True), Row(a=None)]`
It should be a=True for the second Row

The cause is this bit of code: 
if isinstance(value, (int, long)):
value = float(value)

There needs to be a separate check for isinstance(bool), since in python, bools 
are ints too


> DataFrame.fillna() does not work for bools in PySpark
> -
>
> Key: SPARK-19732
> URL: https://issues.apache.org/jira/browse/SPARK-19732
> Project: Spark
>  Issue Type: Bug
>  Components: PySpark
>Affects Versions: 2.1.0
>Reporter: Len Frodgers
>
> In PySpark, the fillna function of DataFrame inadvertently casts bools to 
> ints, so fillna cannot be used to fill True/False.
> e.g. 
> `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
> yields
> `[Row(a=True), Row(a=None)]`
> It should be a=True for the second Row
> The cause is this bit of code: 
> {code}
> if isinstance(value, (int, long)):
> value = float(value)
> {code}
> There needs to be a separate check for isinstance(bool), since in python, 
> bools are ints too



--
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] [Created] (SPARK-19732) DataFrame.fillna() does not work for bools in PySpark

2017-02-24 Thread Len Frodgers (JIRA)
Len Frodgers created SPARK-19732:


 Summary: DataFrame.fillna() does not work for bools in PySpark
 Key: SPARK-19732
 URL: https://issues.apache.org/jira/browse/SPARK-19732
 Project: Spark
  Issue Type: Bug
  Components: PySpark
Affects Versions: 2.1.0
Reporter: Len Frodgers


In PySpark, the fillna function of DataFrame inadvertently casts bools to ints, 
so fillna cannot be used to fill True/False.

e.g. `spark.createDataFrame([Row(a=True),Row(a=None)]).fillna(True).collect()` 
yields
`[Row(a=True), Row(a=None)]`
It should be a=True for the second Row

The cause is this bit of code: 
if isinstance(value, (int, long)):
value = float(value)

There needs to be a separate check for isinstance(bool), since in python, bools 
are ints too



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