使用count统计条数时每次都不一样,而且与真实数据条数对不上,感觉有数据丢失,不知道为什么?
val spa1=MongoSpark.load(ss, ReadConfig(Map("collection" -> “”), Some(ReadConfig(ss))))
val spa2=spa1.select("hyid", "phone", "name", "regtime", "userSour", "amount_tb", "usAmount")
.map{ x =>
val sdf = new SimpleDateFormat("yyyy-MM-dd")
val ts = sdf.parse(x.getString(3)).getTime
val ts2 = new java.sql.Timestamp(ts)
var usersource = ""
if (!x.isNullAt(4)) {
usersource = x.getString(4)
}
(x.getInt(0), x.getString(1), x.getString(2), ts2, usersource, x.getDouble(5), x.getDouble(6))
}
//打印的结果每次都不一样
println(spa1.count(),spa2.count())