DataSet person = spark.read.textfile(path).map(Person::new,Encoders.bean(Person.class))
when i tried above it will works in spark2.4(scala-2.11) but in spark3.1.1(scala-2.12) it's shows as ambigous for the type DataSet. And also wherver i use map,filter,mappartitions,flatmap got ambigous/
but by doing type casting will get success for all transformations spark.read.textfile(path).map((MapFunction<String,Person>)Person::new,Encoders.bean(Person.class))
Is there any other way without typecasting/codechanges