Class InferSchema


  • @NotNull
    public final class InferSchema
    extends java.lang.Object
    A helper that determines the StructType for a BsonDocument and finds the common StructType 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 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.