mongodb spark connector, cannot write Dense or Sparse Vector

744 Views Asked by At

I try to writing my dataframe with a column typed as "dense vector" in mongodb with mongo spark connector.

but i getting this error :

cannot cast [2.0,2.0,115.0,0.0,0.0,0.0,0.0,0.0] into a BsonValue. org.apache.spark.ml.linalg.VectorUDT@3bfc3ba7 has no matching BsonValue.

But why it is not cast as Array[Double], refer to :https://docs.mongodb.com/manual/reference/bson-types/

my dataframe schema :

root

|-- label: double (nullable = false)

|-- date: timestamp (nullable = true)

|-- features: vector (nullable = true)
0

There are 0 best solutions below