java.lang.ClassCastException: test.spark.SampleTest$A cannot be cast to java.lang.Long

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

,

Automatic conversion does not work for uff arguments.

Example: val add1 = udf {p: Long => p + 1} should be invoked using add1(lit(0L)). add1(lit(0))will throw this exception.

Solutions on the web

via Stack Overflow by jigsaw
, 1 year ago
test.spark.SampleTest$A cannot be cast to java.lang.Long
via GitHub by kscaldef
, 4 months ago
java.lang.Integer cannot be cast to java.lang.Long
via Google Groups by softprops, 2 years ago
java.lang.Integer cannot be cast to java.lang.Long
via Stack Overflow by Patrick
, 5 months ago
java.lang.Double cannot be cast to java.lang.Long
java.lang.ClassCastException: test.spark.SampleTest$A cannot be cast to java.lang.Long
at scala.runtime.BoxesRunTime.unboxToLong(BoxesRunTime.java:110)
at org.apache.spark.sql.catalyst.expressions.BaseGenericInternalRow$class.getLong(rows.scala:42)
at org.apache.spark.sql.catalyst.expressions.GenericInternalRow.getLong(rows.scala:221)

Users with the same issue

Once, 1 month ago
3 times, 7 months ago
4 times, 1 year ago
5 times, 1 year ago
3 times, 1 year ago

Write tip

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