I am using the below code to run in Qubole Notebook and the code is running successfully.
case class cls_Sch(Id:String, Name:String)
class myClass {
implicit val sparkSession = org.apache.spark.sql.SparkSession.builder().enableHiveSupport().getOrCreate()
sparkSession.sql("set spark.sql.crossJoin.enabled = true")
sparkSession.sql("set spark.sql.caseSensitive=false")
import sparkSession.sqlContext.implicits._
import org.apache.hadoop.fs.{FileSystem, Path, LocatedFileStatus, RemoteIterator, FileUtil}
import org.apache.hadoop.conf.Configuration
import org.apache.spark.sql.DataFrame
def my_Methd() {
var my_df = Seq(("1","Sarath"),("2","Amal")).toDF("Id","Name")
my_df.as[cls_Sch].take(my_df.count.toInt).foreach(t => {
println(s"${t.Name}")
})
}
}
val obj_myClass = new myClass()
obj_myClass.my_Methd()
However when I run in the same code in Qubole's Analyze, I am getting the below error.
When I take out the below code, its running fine in Qubole's Anlayze.
my_df.as[cls_Sch].take(my_df.count.toInt).foreach(t => {
println(s"${t.Name}")
})
I believe somewhere I have to change the usage of case
class.
I am using Spark 2.3.
Can someone please let me know how to solve this issue.
Please let me know if you need any other details.