struct-type-encoder (homepage)
Deriving Spark DataFrame schemas from case classes
@BenFradet / (0)
struct-type-encoder derives instances of `StructType` from your case class automatically:
import ste.StructTypeEncoder
import ste.StructTypeEncoder._
val derived = spark
.read
.schema(StructTypeEncoder[MyCaseClass].encode)
.json("/some/dir/*.json")
.as[MyCaseClass]
No inference, no boilerplate!
Tags
How to
Include this package in your Spark Applications using:
spark-shell, pyspark, or spark-submit
> $SPARK_HOME/bin/spark-shell --packages com.github.benfradet:struct-type-encoder_2.11:0.2.0
sbt
In your sbt build file, add:
libraryDependencies += "com.github.benfradet" % "struct-type-encoder_2.11" % "0.2.0"
Maven
In your pom.xml, add:<dependencies> <!-- list of dependencies --> <dependency> <groupId>com.github.benfradet</groupId> <artifactId>struct-type-encoder_2.11</artifactId> <version>0.2.0</version> </dependency> </dependencies>
Releases
Version: 0.2.0 ( 5c03d4 | zip | jar ) / Date: 2018-02-26 / License: Apache-2.0 / Scala version: 2.11
Version: 0.1.0 ( f0e73d | zip | jar ) / Date: 2017-07-10 / License: Apache-2.0 / Scala version: 2.11