public class SparkRowConverter extends Object
| Modifier and Type | Method and Description |
|---|---|
org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> |
emptyDataFrame(org.apache.spark.sql.SparkSession spark)
Returns an empty data frame that has the Spark schema for the resource.
|
static SparkRowConverter |
forResource(ca.uhn.fhir.context.FhirContext context,
String resourceTypeUrl)
Returns a row converter for the given resource type.
|
static SparkRowConverter |
forResource(ca.uhn.fhir.context.FhirContext context,
String resourceTypeUrl,
List<String> containedResourceTypeUrls)
Returns a row converter for the given resource type.
|
String |
getResourceType()
Returns the FHIR type of the resource being converted.
|
org.apache.spark.sql.types.StructType |
getSchema()
Returns the Spark schema equivalent for the FHIR resource.
|
org.apache.spark.sql.Row |
resourceToRow(org.hl7.fhir.instance.model.api.IBaseResource resource)
Converts a given FHIR resource to a Spark row.
|
org.hl7.fhir.instance.model.api.IBaseResource |
rowToResource(org.apache.spark.sql.Row row) |
org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> |
toDataFrame(org.apache.spark.sql.SparkSession spark,
List<org.hl7.fhir.instance.model.api.IBaseResource> resources)
Returns a dataframe.
|
public static SparkRowConverter forResource(ca.uhn.fhir.context.FhirContext context, String resourceTypeUrl)
context - the FHIR contextresourceTypeUrl - the URL of the resource typepublic static SparkRowConverter forResource(ca.uhn.fhir.context.FhirContext context, String resourceTypeUrl, List<String> containedResourceTypeUrls)
Resources that would be contained must be statically declared through this method via similar URLs.
context - the FHIR contextresourceTypeUrl - the URL of the resource typecontainedResourceTypeUrls - the list of URLs of contained resource typespublic org.apache.spark.sql.Row resourceToRow(org.hl7.fhir.instance.model.api.IBaseResource resource)
resource - the FHIR resourcepublic org.hl7.fhir.instance.model.api.IBaseResource rowToResource(org.apache.spark.sql.Row row)
public org.apache.spark.sql.types.StructType getSchema()
public String getResourceType()
public org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> emptyDataFrame(org.apache.spark.sql.SparkSession spark)
spark - the spark sessionpublic org.apache.spark.sql.Dataset<org.apache.spark.sql.Row> toDataFrame(org.apache.spark.sql.SparkSession spark,
List<org.hl7.fhir.instance.model.api.IBaseResource> resources)
spark - the spark session.resources - the resources to convert into Spark rows.Copyright © 2020. All rights reserved.