java.lang.UnsupportedOperationException: empty collection

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,

You try to read an empty csv into a dataframe with .option("header", "true"). Make sure that the file contains at least the header line.

java.lang.UnsupportedOperationException: empty collection
at org.apache.spark.rdd.RDD$$anonfun$first$1.apply(RDD.scala:1318)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:147)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:108)
at org.apache.spark.rdd.RDD.withScope(RDD.scala:310)
at org.apache.spark.rdd.RDD.first(RDD.scala:1315)
at org.apache.spark.mllib.recommendation.MatrixFactorizationModel.validateFeatures(MatrixFactorizationModel.scala:67)
at org.apache.spark.mllib.recommendation.MatrixFactorizationModel.(MatrixFactorizationModel.scala:62)
at org.apache.spark.mllib.recommendation.ALS.run(ALS.scala:266)
at org.apache.spark.mllib.recommendation.ALS$.train(ALS.scala:328)

Users with the same issue

Once, 1 month ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.