Skip to content

Commit

Permalink
Fix Scala ArrayBuffer cast to Spark ArrayData for Scala 2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
hipp0gryph committed Aug 11, 2024
1 parent ddd1ef5 commit e93fa19
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ private[xml] object StaxXmlParser extends Serializable {

case ArrayType(dt: DataType, _) =>
val values = Option(row(index))
.map(_.asInstanceOf[ArrayBuffer[Any]])
.getOrElse(ArrayBuffer.empty[Any])
.map(_.asInstanceOf[Array[Any]])
.getOrElse(Array.empty[Any])
val newValue = dt match {
case st: StructType =>
convertObjectWithAttributes(parser, st, options, attributes)
Expand All @@ -345,8 +345,8 @@ private[xml] object StaxXmlParser extends Serializable {
row(anyIndex) = newValue
case ArrayType(StringType, _) =>
val values = Option(row(anyIndex))
.map(_.asInstanceOf[ArrayBuffer[String]])
.getOrElse(ArrayBuffer.empty[String])
.map(_.asInstanceOf[Array[String]])
.getOrElse(Array.empty[String])
row(anyIndex) = values :+ newValue
}
} else {
Expand Down

0 comments on commit e93fa19

Please sign in to comment.