For me, the issue is resolved after upgrading the Scala version from 2.11.12 to 2.12.10. Along with this I also updated the suffix of artifactId from 2.11 to 2.12
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.12</artifactId>
<version>2.4.0</version>
</dependency>