val df = spark.sql("select count(1) times, day, cmsId from access_logs where day = '20170511' " +
"and cmsType = 'video' group by day,cmsId order by times desc")
val
val list = new ListBuffer[DayVideoAccessStat]
df.foreach(info => {
var day = info.getAs[Int]("day")
var cmsId = info.getAs[Long]("cmsId")
var times = info.getAs[Long]("times")
list.append(DayVideoAccessStat(day.toString, cmsId, times))
})
StatDao.insertDayVideoAccessTopN(list)```
为什么我这样写,每次循环完list的长度还是0,我是在for之外创建的list啊