From 85d887890fcc6240c43e5be53d68e0d3d4a260c7 Mon Sep 17 00:00:00 2001 From: Kevin Wallimann Date: Thu, 1 Feb 2024 11:54:32 +0100 Subject: [PATCH] Use previous versions behaviour as default for new constructor parameter --- .../org/apache/spark/sql/avro/AbrisAvroDeserializer.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/scala/org/apache/spark/sql/avro/AbrisAvroDeserializer.scala b/src/main/scala/org/apache/spark/sql/avro/AbrisAvroDeserializer.scala index 0c4f993..93ab0b7 100644 --- a/src/main/scala/org/apache/spark/sql/avro/AbrisAvroDeserializer.scala +++ b/src/main/scala/org/apache/spark/sql/avro/AbrisAvroDeserializer.scala @@ -36,7 +36,10 @@ class AbrisAvroDeserializer(rootAvroType: Schema, rootCatalystType: DataType) { .newInstance(rootAvroType, rootCatalystType) // Spark 2.4 - }.recover { case _: NoSuchMethodException => clazz.getConstructor(classOf[Schema], classOf[DataType], classOf[String]) - .newInstance(rootAvroType, rootCatalystType, "LEGACY") // Spark 3.0 + + .newInstance(rootAvroType, rootCatalystType, "LEGACY") // Spark 3.0 - Spark 3.5.0 (including) + }.recover { case _: NoSuchMethodException => + clazz.getConstructor(classOf[Schema], classOf[DataType], classOf[String], classOf[Boolean]) + .newInstance(rootAvroType, rootCatalystType, "LEGACY", false: java.lang.Boolean) // Spark 3.5.x + } .get .asInstanceOf[AvroDeserializer]