我怎么定义一个scala宏来转换一个火花的结构类型,即
val foo = new StructType ()
.add ("foo", LongType)
.add ("bar", LongType)
到以下案例类:
MyCaseClass(foo:Long, bar:Long)
trait Schema {
def schema: Seq[MyCol]
}
case class MyCol(name: String, colType: AbstractDataType, nullabilty: Boolean)
case class FooSchema() extends Schema {
override def schema: Seq[MyCol] = Seq(MyCol("foo", IntegerType, false), MyCol("bar", DoubleType, false))
}