Skip to content

Commit

Permalink
Make AvroUtils compatible with older versions of Avro (#33102) (#33105)
Browse files Browse the repository at this point in the history
* Make AvroUtils compatible with older versions of Avro

* Create beam_PostCommit_Java_Avro_Versions.json

* Update AvroUtils.java

* Fix nullness
  • Loading branch information
damccorm authored Nov 13, 2024
1 parent a0cbdd4 commit 7113db5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/trigger_files/beam_PostCommit_Java_Avro_Versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"comment": "Modify this file in a trivial way to cause this test suite to run",
"modification": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@
*
* 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);
Expand Down Expand Up @@ -484,7 +487,8 @@ public static Field toBeamField(org.apache.avro.Schema.Field field) {
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() {}
Expand Down

0 comments on commit 7113db5

Please sign in to comment.