You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Satya Narayan (JIRA)" <ji...@apache.org> on 2015/10/19 08:27:05 UTC

[jira] [Created] (SPARK-11180) DataFrameNaFunctions fills does not support Boolean Type:

Satya Narayan created SPARK-11180:
-------------------------------------

             Summary: DataFrameNaFunctions fills 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.1, 1.5.0
            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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org