OJAIDocument represents a JSON document which can be accessed with dynamic object model as well as through setters and getters.
OJAIDocument represents a JSON document which can be accessed with dynamic object model as well as through setters and getters.
OJAIDocument extends the original org.ojai.Document with input and output types mapped to that of scala types.
To create an OJAIDocument use the factory function newDocument in MapRDBSpark or through sparkContext functions loadMapRDBTable.
Example:
val doc = MapRDBSpark.newDocument(jsonString) or val docs = sc.loadMapRDBTable(tableName)
Here are the ways to access elements in OJAIDocument
doc.address -- accesses the element with address as the key and returns the value specified for it as AnyRef
doc.address[String] -- access the elements with address as the key and returns the value specified for it as String
doc.getString("address") -- getString is an accessor method that can also be used to get the value for address as String.
Here are the ways to set value to a key in OJAIDocument
doc.city = "San Francisco" or doc.set("city", "San Francisco")
OJAIDocument represents a JSON document which can be accessed with dynamic object model as well as through setters and getters. OJAIDocument extends the original org.ojai.Document with input and output types mapped to that of scala types. To create an OJAIDocument use the factory function newDocument in MapRDBSpark or through sparkContext functions loadMapRDBTable.
val doc = MapRDBSpark.newDocument(jsonString) or val docs = sc.loadMapRDBTable(tableName) Here are the ways to access elements in OJAIDocument doc.address -- accesses the element with address as the key and returns the value specified for it as AnyRef doc.address[String] -- access the elements with address as the key and returns the value specified for it as String doc.getString("address") -- getString is an accessor method that can also be used to get the value for address as String. Here are the ways to set value to a key in OJAIDocument doc.city = "San Francisco" or doc.set("city", "San Francisco")