Member since
05-15-2018
8
Posts
0
Kudos Received
0
Solutions
05-17-2018
04:56 PM
@Abdul Rahim Please use following code case class Person(index:Long,item:String,cost:Float,Tax:Float,Total:Float) val peopleDs = sc.textFile("C:/hcubeapi/test-case1123.txt").map(_.split(",").map(_.trim)).map(attributes=> Person(attributes(0).toLong,attributes(1).toString,attributes(2).toFloat,attributes(3).toFloat,attributes(4).toFloat)).toDF()
peopleDs.createOrReplaceTempView("people") val res = spark.sql("Select * from people") res.show()
... View more