Skip to content

Instantly share code, notes, and snippets.

@visualskyrim
Last active April 16, 2020 07:12
Show Gist options
  • Save visualskyrim/ad03e83584292b20f4ca6ccd3e9a9a88 to your computer and use it in GitHub Desktop.
Save visualskyrim/ad03e83584292b20f4ca6ccd3e9a9a88 to your computer and use it in GitHub Desktop.
case class InputData(...)
val dataSchema =
ScalaReflection.schemaFor[InputData].dataType.asInstanceOf[StructType]
val dataset: Dataset[InputData] = spark
.read
.schema(dataSchema)
.parquet(incomingPath)
.as[InputData]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment