Skip to content

Instantly share code, notes, and snippets.

@izeigerman
Created January 29, 2021 19:00
Show Gist options
  • Select an option

  • Save izeigerman/fe0533335881206b4b125273191dfa80 to your computer and use it in GitHub Desktop.

Select an option

Save izeigerman/fe0533335881206b4b125273191dfa80 to your computer and use it in GitHub Desktop.
sealed trait DeviceModel
object DeviceModel {
implicit val deviceModelDataSource = new DataSource[DeviceModel, Unit] {
override def read(parameters: Unit)(implicit spark: SparkSession) =
AnnotatedDataFrame[DeviceModel](
spark
.createDataFrame(Seq(
(0, "model_0"),
(1, "model_1")
))
.toDF("device_model_id", "model_name")
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment