My use case is to read an existing json-schema file, parse this json-schema file and build a Spark DataFrame schema out of it. To start off I followed the steps mentioned here.
Steps followed
1.Imported the library from Maven
2.Restarted the cluster
3.Created a sample JSON schema file
4.Used this code to read the sample schema file
val schema = SchemaConverter.convert("/FileStore/tables/schemaFile.json")
When I run above command I get error: not found: value SchemaConverter
To ensure that the library is being called I reattached the notebook to cluster after restarting the cluster.
In addition to trying out the above method, I tried the below as well. I replaced jsonString with the actual JSON schema.
import org.apache.spark.sql.types.{DataType, StructType}
val newSchema = DataType.fromJson(jsonString).asInstanceOf[StructType]
the sample Schema I've been playing with has 300+feilds, for simplicity, I used the sample schema from here.