正在解决线程“main”java.lang.arrayindexoutofboundsexception中的异常:6

lnlaulya  于 2021-05-19  发布在  Spark
关注(0)|答案(0)|浏览(301)

我想知道为什么我会犯这个错误。。
线程“main”java.lang.arrayindexoutofboundsexception中出现异常:6

val inputData = readCSVFileLines(fileSystem, inputFile, skipHeader = true).toSeq                                                                                                    
     val filter = inputData.filter(x => x.nonEmpty)                                                                                                                                     
       .map(x => x.split(","))                                                                                                                                                           
       .map(x => Revenue(x(6), x(5), x(0), x(7).toDouble))                                                                                                                               

 val writer = new PrintWriter(new File(outputFile))                                                                                                                                  
 writer.write("Sales Date,Customer,Article,Revenue,Last Date,Average Last Date,Average Next Date")       
 filter.foreach(x => {                                                                                                                                                              
   val (back90, avgRevenue1) = back90Average(filtinp, x)                                                                                                                             
   val (next30, avgRevenue2) = next30Average(filtinp, x)                                                                                                                             
   writer.write(s"${x.date},${x.customer},${x.article},${x.revenue},${back90},${avgRevenue1},${next30},${avgRevenue2}\n")                                                              
 })                                                                                                                                                                                  
 writer.close()

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题