Skip to content

Commit 51c0d61

Browse files
committed
Update avro to 1.12.0
1 parent 6982ac9 commit 51c0d61

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

project/BuildHelper.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ object BuildHelper {
3838
val zioPreludeVersion = "1.0.0-RC39"
3939
val zioOpticsVersion = "0.2.2"
4040
val zioBsonVersion = "1.0.6"
41-
val avroVersion = "1.11.4"
41+
val avroVersion = "1.12.0"
4242
val bsonVersion = "4.11.3"
4343
val zioConstraintlessVersion = "0.3.3"
4444
val scalaCollectionCompatVersion = "2.13.0"

zio-schema-avro/src/main/scala/zio/schema/codec/AvroCodec.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,18 +466,17 @@ object AvroCodec {
466466

467467
}
468468
private def decodeSequence[A](a: A, schema: Schema[A]) = {
469-
val array = a.asInstanceOf[GenericData.Array[Any]]
470-
val result = array.asScala.toList.map(decodeValue(_, schema))
471-
val traversed: Either[List[DecodeError], List[A]] = result.partition(_.isLeft) match {
469+
val array = a.asInstanceOf[GenericData.AbstractArray[Any]]
470+
val result = array.asScala.map(decodeValue(_, schema))
471+
val traversed = result.partition(_.isLeft) match {
472472
case (Nil, decoded) => Right(for (Right(i) <- decoded) yield i)
473473
case (errors, _) => Left(for (Left(s) <- errors) yield s)
474474
}
475-
val combined: Either[DecodeError, List[A]] = traversed.left.map { errors =>
475+
val combined = traversed.left.map { errors =>
476476
errors.foldLeft[DecodeError](DecodeError.MalformedFieldWithPath(Chunk.empty, "Sequence decoding failed."))(
477477
(acc, error) => acc.and(DecodeError.MalformedFieldWithPath(Chunk.empty, s"${error.message}"))
478478
)
479479
}
480-
481480
combined.map(Chunk.fromIterable(_))
482481
}
483482

0 commit comments

Comments
 (0)