Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

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