You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by da...@apache.org on 2024/11/13 21:30:40 UTC
(beam) branch release-2.61.0 updated: Make AvroUtils compatible with older versions of Avro (#33102) (#33105)
This is an automated email from the ASF dual-hosted git repository.
damccorm pushed a commit to branch release-2.61.0
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/release-2.61.0 by this push:
new 7113db52ca9 Make AvroUtils compatible with older versions of Avro (#33102) (#33105)
7113db52ca9 is described below
commit 7113db52ca92ab0f47417bd822fb6c7e36313973
Author: Danny McCormick <da...@google.com>
AuthorDate: Wed Nov 13 16:30:33 2024 -0500
Make AvroUtils compatible with older versions of Avro (#33102) (#33105)
* Make AvroUtils compatible with older versions of Avro
* Create beam_PostCommit_Java_Avro_Versions.json
* Update AvroUtils.java
* Fix nullness
---
.github/trigger_files/beam_PostCommit_Java_Avro_Versions.json | 4 ++++
.../apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java | 8 ++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/.github/trigger_files/beam_PostCommit_Java_Avro_Versions.json b/.github/trigger_files/beam_PostCommit_Java_Avro_Versions.json
new file mode 100644
index 00000000000..1efc8e9e440
--- /dev/null
+++ b/.github/trigger_files/beam_PostCommit_Java_Avro_Versions.json
@@ -0,0 +1,4 @@
+{
+ "comment": "Modify this file in a trivial way to cause this test suite to run",
+ "modification": 1
+}
diff --git a/sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java b/sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java
index bfbab6fe87f..da7daf605d8 100644
--- a/sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java
+++ b/sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java
@@ -141,7 +141,10 @@ import org.joda.time.ReadableInstant;
*
* is used.
*/
-@SuppressWarnings({"rawtypes"})
+@SuppressWarnings({
+ "nullness", // TODO(https://github.com/apache/beam/issues/20497)
+ "rawtypes"
+})
public class AvroUtils {
private static final ForLoadedType BYTES = new ForLoadedType(byte[].class);
private static final ForLoadedType JAVA_INSTANT = new ForLoadedType(java.time.Instant.class);
@@ -484,7 +487,8 @@ public class AvroUtils {
public static org.apache.avro.Schema.Field toAvroField(Field field, String namespace) {
org.apache.avro.Schema fieldSchema =
getFieldSchema(field.getType(), field.getName(), namespace);
- return new org.apache.avro.Schema.Field(field.getName(), fieldSchema, field.getDescription());
+ return new org.apache.avro.Schema.Field(
+ field.getName(), fieldSchema, field.getDescription(), (Object) null);
}
private AvroUtils() {}