這是我下面的代碼:如何處理空值在SparkSQL Dataframes
val ebayds = sc.textFile("/user/spark/xbox.csv")
case class Auction(auctionid: String, bid: Float, bidtime: Float, bidder: String, bidderrate: Int, openbid: Float, price: Float)
val ebay = ebayds.map(a=>a.split(",")).map(p=>Auction(p(0),p(1).toFloat,p(2).toFloat,p(3),p(4).toInt,p(5).toFloat,p(6).toFloat)).toDF()
ebay.select("auctionid").distinct.count
,我得到的錯誤是:
For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
可能的重複[在Spark DataFrame中替換空值](https:// stackoverflow。com/questions/33376571/replace-null-values-in-spark-dataframe) – eliasah
看起來你有一個空字符串''「',而不是'null'。沒有? –