Skip to content

Commit c91036e

Browse files
authored
fix: CometLiteral class cast exception with arrays (apache#2718)
1 parent 3ea6ad6 commit c91036e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spark/src/main/scala/org/apache/comet/serde/literals.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import java.lang
2323

2424
import org.apache.spark.internal.Logging
2525
import org.apache.spark.sql.catalyst.expressions.{Attribute, Literal}
26-
import org.apache.spark.sql.catalyst.util.GenericArrayData
26+
import org.apache.spark.sql.catalyst.util.ArrayData
2727
import org.apache.spark.sql.types.{ArrayType, BinaryType, BooleanType, ByteType, DateType, Decimal, DecimalType, DoubleType, FloatType, IntegerType, LongType, NullType, ShortType, StringType, TimestampNTZType, TimestampType}
2828
import org.apache.spark.unsafe.types.UTF8String
2929

@@ -92,7 +92,7 @@ object CometLiteral extends CometExpressionSerde[Literal] with Logging {
9292

9393
case arr: ArrayType =>
9494
val listLiteralBuilder: ListLiteral.Builder =
95-
makeListLiteral(value.asInstanceOf[GenericArrayData].array, arr)
95+
makeListLiteral(value.asInstanceOf[ArrayData].array, arr)
9696
exprBuilder.setListVal(listLiteralBuilder.build())
9797
exprBuilder.setDatatype(serializeDataType(dataType).get)
9898
case dt =>
@@ -198,7 +198,7 @@ object CometLiteral extends CometExpressionSerde[Literal] with Logging {
198198
})
199199
case a: ArrayType =>
200200
array.foreach(v => {
201-
val casted = v.asInstanceOf[GenericArrayData]
201+
val casted = v.asInstanceOf[ArrayData]
202202
listLiteralBuilder.addListValues(if (casted != null) {
203203
makeListLiteral(casted.array, a)
204204
} else ListLiteral.newBuilder())

0 commit comments

Comments
 (0)