I'm creating a Spark dataset in scala using a case class and the spark.sql({query}).as[MyCaseClass] syntax
All is fine until I try to create a dataset with one of my members defined as Array[Array[Byte]]
case class HbaseRow(
ip: Array[Array[Byte]]
)
val hbaseDataSet = spark
.sql("""select ip from test_data""")
.as[HbaseRow]
Normally this works fine but with the array of byte arrays this fails.
java.lang.ClassCastException:
org.apache.spark.sql.types.BinaryType$ cannot be cast to org.apache.spark.sql.types.ObjectType
at org.apache.spark.sql.catalyst.ScalaReflection$$anonfun$org$apache$spark$sql$catalyst$ScalaReflection$$arrayClassFor$1.apply(ScalaReflection.scala:106)
at org.apache.spark.sql.catalyst.ScalaReflection$$anonfun$org$apache$spark$sql$catalyst$ScalaReflection$$arrayClassFor$1.apply(ScalaReflection.scala:95)
at scala.reflect.internal.tpe.TypeConstraints$UndoLog.undo(TypeConstraints.scala:56)
the column is a spark array of IP addresses encoded as byte arrays themselves.