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

Satya Narayan updated SPARK-11180:
----------------------------------
    Description: 
Currently  DataFrame.na.fill does not support  Boolean primitive type. We have 
use cases where while data massaging/preparation we want to fill boolean 
columns with false/true value. 
Ex: 
val empDf = sqlContext.createDataFrame(Seq[(Integer,String,java.lang.Boolean)]
((1,null,null),(2,"SVP",true),(3,"Dir",false)))
.toDF("EmpId","Designation","isOfficer")
empDf: org.apache.spark.sql.DataFrame = [EmpId: int, Designation: string, 
isOfficer: boolean]

scala> empDf.show

|EmpId|Designation|isOfficer|
|    1|       null|     null|
|    2|        SVP|     true|
|    3|        Dir|    false|


We want to set "isOfficer" false whenever there is null. 

scala> empDf.na.fill(Map("isOfficer"->false))
throws exception 
java.lang.IllegalArgumentException: Unsupported value type java.lang.Boolean 
(false).
        at 
org.apache.spark.sql.DataFrameNaFunctions$$anonfun$fill0$1.apply(DataFrameNaFunctions.scala:370)
...........

Can you add support for Boolean into na.fill function.


  was:
Currently  DataFrame.na.fill does not support  Boolean primitive type. We have 
use cases where while data massaging/preparation we want to fill boolean 
columns with false/true value. 
Ex: 
val empDf = 
sqlContext.createDataFrame(Seq[(Integer,String,java.lang.Boolean)]((1,null,null),(2,"SVP",true),(3,"Dir",false))).toDF("EmpId","Designation","isOfficer")
empDf: org.apache.spark.sql.DataFrame = [EmpId: int, Designation: string, 
isOfficer: boolean]

scala> empDf.show
+-----+-----------+---------+
|EmpId|Designation|isOfficer|
+-----+-----------+---------+
|    1|       null|     null|
|    2|        SVP|     true|
|    3|        Dir|    false|
+-----+-----------+---------+

We want to set "isOfficer" false whenever there is null. 

scala> empDf.na.fill(Map("isOfficer"->false))
throws exception 
java.lang.IllegalArgumentException: Unsupported value type java.lang.Boolean 
(false).
        at 
org.apache.spark.sql.DataFrameNaFunctions$$anonfun$fill0$1.apply(DataFrameNaFunctions.scala:370)
...........

Can you add support for Boolean into na.fill function.



>  DataFrame.na.fill does not support Boolean Type:
> -------------------------------------------------
>
>                 Key: SPARK-11180
>                 URL: https://issues.apache.org/jira/browse/SPARK-11180
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 1.5.0, 1.5.1
>            Reporter: Satya Narayan
>            Priority: Minor
>
> Currently  DataFrame.na.fill does not support  Boolean primitive type. We 
> have use cases where while data massaging/preparation we want to fill boolean 
> columns with false/true value. 
> Ex: 
> val empDf = sqlContext.createDataFrame(Seq[(Integer,String,java.lang.Boolean)]
> ((1,null,null),(2,"SVP",true),(3,"Dir",false)))
> .toDF("EmpId","Designation","isOfficer")
> empDf: org.apache.spark.sql.DataFrame = [EmpId: int, Designation: string, 
> isOfficer: boolean]
> scala> empDf.show
> |EmpId|Designation|isOfficer|
> |    1|       null|     null|
> |    2|        SVP|     true|
> |    3|        Dir|    false|
> We want to set "isOfficer" false whenever there is null. 
> scala> empDf.na.fill(Map("isOfficer"->false))
> throws exception 
> java.lang.IllegalArgumentException: Unsupported value type java.lang.Boolean 
> (false).
>       at 
> org.apache.spark.sql.DataFrameNaFunctions$$anonfun$fill0$1.apply(DataFrameNaFunctions.scala:370)
> ...........
> Can you add support for Boolean into na.fill function.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to