classtag

Prove that a runtimeClass satisfies a type Bound in Scala

坚强是说给别人听的谎言 提交于 2021-02-08 08:37:16
问题 I have a method that writes one of my classes Foo , which is defined as Thrift, in Parquet form. import Foo import org.apache.spark.rdd.RDD import org.apache.thrift.TBase import org.apache.hadoop.mapreduce.Job import org.apache.parquet.hadoop.ParquetOutputFormat import org.apache.parquet.hadoop.thrift.ParquetThriftOutputFormat def writeThriftParquet(rdd: RDD[Foo], outputPath: String): Unit = { val job = Job.getInstance() ParquetThriftOutputFormat.setThriftClass(job, classOf[Foo])

Passing case class into function arguments

时光怂恿深爱的人放手 提交于 2019-12-11 16:16:05
问题 sorry for asking a simple question. I want to pass a case class to a function argument and I want to use it further inside the function. Till now I have tried this with TypeTag and ClassTag but for some reason, I am unable to properly use it or may be I am not looking at the correct place. Use cases is something similar to this: case class infoData(colA:Int,colB:String) case class someOtherData(col1:String,col2:String,col3:Int) def readCsv[T:???](path:String,passedCaseClass:???): Dataset[???]