I got an exception while executing the below code snippet. The dataset i was working with is "stocks.csv" and which has the columns - date, symbol, volume, open, close, high, low and adjclose
val stock =
sc.textFile("C:/Users/kondr/Desktop/stocks/stocks.csv")
val splits = stock.map(record => record.split(","))
val symvol = splits.map(arr => (arr(1),arr(2).toInt))
val maxvol = symvol.reduceByKey((vol1,vol2) =>
Math.max(vol1,vol2),1)
maxvol.collect().foreach(println)
Error Message
21/05/05 14:09:31 ERROR Executor: Exception in task 0.0 in stage 2.0 (TID 2) java.lang.NumberFormatException: For input string: "volume" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)