1
我使用Spark和Scala作爲語言。我正在嘗試讀取文件並計算其中的空格和引號的數量。我得到正確的輸出空間,但不正確的文件中的引號數量。表達是否正確?使用Spark中的Scala對文件中的引號數進行計數
val file = sc.textFile("file:///Users/Desktop/test/employee.txt")
1) val space = file.filter(line => line.contains(" ")).count() --O/P = 2
2) val counter = file.filter(line => line.contains('"')).count() - Wrong Output
File :
"abc","def","xyc","asas", "esd"
"343","32","234","11", "RE"