The following error is due to missing winutils binary in the classpath while running Spark application. Winutils is a part of Hadoop ecosystem and is not included in Spark. The actual functionality of your application may run correctly even after an exception is thrown. But it is better to have it in place to avoid unnecessary problems. In order to avoid error, download winutils.exe binary and add the same to the classpath.
Copy the downloaded file to ANY_DIRECTORY/bin/winutils.exe
SetUp your HADOOP_HOME environment variable on the OS level or programmatically:
System.setProperty("hadoop.home.dir", "Full\folder\path:\\winutil\\");
If you want to know more about Scala, then do check out this awesome video tutorial: