I am having an issue with defining the structure for the json document.
Now i am trying to do the same schema on streamread.
val jsonSchema = StructType([ StructField("associatedEntities", struct<driver:StringType,truck:StringType>, True),
StructField("heading", StringType, True),
StructField("location", struct<accuracyType:StringType,captureDateTime:StringType,cityStateCode:StringType,description:StringType,latitude:DoubleType,longitude:DoubleType,quality:StringType,transmitDateTime:StringType>, True),
StructField("measurements", array<struct<type:StringType,uom:StringType,value:StringType>>, True),
StructField("source", struct<entityType:StringType,key:StringType,vendor:StringType>, True),
StructField("speed", DoubleType, True)])
val df = spark
.readStream
.format("eventhubs")
//.schema(jsonSchema)
.options(ehConf.toMap)
.load()
When I run this cell in the notebook ":15: error: illegal start of simple expression val jsonSchema = StructType([ StructField("associatedEntities", struct, True),"
Edit: The goal is to get the data into a dataframe. I can get the json string from the body of the event hub message but i am not sure what to do from there if i cant get the schema to work.