Class RowToBsonDocumentConverter

  • All Implemented Interfaces:
    java.io.Serializable

    @NotNull
    public final class RowToBsonDocumentConverter
    extends java.lang.Object
    implements java.io.Serializable
    The helper for conversion of GenericRowWithSchema instances to BsonDocuments.

    All Spark types are considered convertible to Bson types.

    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.bson.BsonDocument fromRow​(org.apache.spark.sql.catalyst.InternalRow row)
      Converts a Row to a BsonDocument
      org.bson.BsonDocument fromRow​(Row row)
      Converts a Row to a BsonDocument
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RowToBsonDocumentConverter

        @TestOnly
        public RowToBsonDocumentConverter()
        Construct a new instance
      • RowToBsonDocumentConverter

        public RowToBsonDocumentConverter​(StructType schema)
        Construct a new instance
        Parameters:
        schema - the schema for the row
    • Method Detail

      • fromRow

        public org.bson.BsonDocument fromRow​(org.apache.spark.sql.catalyst.InternalRow row)
        Converts a Row to a BsonDocument
        Parameters:
        row - the row to convert
        Returns:
        a BsonDocument representing the data in the row
        Throws:
        DataException - if the Row does not have a schema associated with it
      • fromRow

        public org.bson.BsonDocument fromRow​(Row row)
        Converts a Row to a BsonDocument
        Parameters:
        row - the row to convert
        Returns:
        a BsonDocument representing the data in the row
        Throws:
        DataException - if the Row does not have a schema associated with it