Class InferSchema
- java.lang.Object
-
- com.mongodb.spark.sql.connector.schema.InferSchema
-
@NotNull public final class InferSchema extends java.lang.Object
A helper that determines theStructType
for aBsonDocument
and finds the commonStructType
for a list of BsonDocuments.All Bson types are considered convertible to Spark types. For any Bson types that doesn't have a direct conversion to a Spark type then a String type will be used.
-
-
Field Summary
Fields Modifier and Type Field Description static Metadata
INFERRED_METADATA
Inferred schema metadata
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StructType
inferSchema(CaseInsensitiveStringMap options)
Infer the schema for the collectionstatic boolean
isInferred(StructType schema)
-
-
-
Field Detail
-
INFERRED_METADATA
public static final Metadata INFERRED_METADATA
Inferred schema metadata
-
-
Method Detail
-
inferSchema
public static StructType inferSchema(CaseInsensitiveStringMap options)
Infer the schema for the collection- Parameters:
options
- the configuration options to determine the namespace to determine the schema for- Returns:
- the schema
-
isInferred
public static boolean isInferred(StructType schema)
- Parameters:
schema
- the schema- Returns:
- true if the schema has been inferred.
-
-