Generate a Spark StructType / Schema from a case class

前端 未结 4 1756
情歌与酒
情歌与酒 2020-11-29 21:50

If I wanted to create a StructType (i.e. a DataFrame.schema) out of a case class, is there a way to do it without creating a Dat

4条回答
  •  清歌不尽
    2020-11-29 22:04

    in case someone wants to do this for a custom Java bean:

    ExpressionEncoder.javaBean(Event.class).schema().json()
    

提交回复
热议问题