Skip to content

Instantly share code, notes, and snippets.

@bepcyc
Created February 21, 2019 17:28
Show Gist options
  • Select an option

  • Save bepcyc/22f5fbd2192a888fd5669bb4006fbd44 to your computer and use it in GitHub Desktop.

Select an option

Save bepcyc/22f5fbd2192a888fd5669bb4006fbd44 to your computer and use it in GitHub Desktop.
Generate Avro Schema out of Apache Spark DataFrame
import org.apache.spark.sql.avro.SchemaConverters
SchemaConverters.toAvroType(df.schema) // add .toString if you need JSON here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment