clairemcginty commented on code in PR #32352:
URL: https://github.com/apache/beam/pull/32352#discussion_r1735188030


##########
sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/io/SerializableAvroCodecFactory.java:
##########
@@ -50,6 +50,9 @@ class SerializableAvroCodecFactory implements Externalizable {
   private static final Pattern deflatePattern = Pattern.compile(DEFLATE_CODEC 
+ "-(?<level>-?\\d)");
   private static final Pattern xzPattern = Pattern.compile(XZ_CODEC + 
"-(?<level>\\d)");
 
+  // Don't reference `DataFileConstants.ZSTANDARD_CODEC` directly for Avro 1.8 
compat
+  private static final Pattern zstdPattern = 
Pattern.compile("zstandard\\[(?<level>\\d+)\\]");

Review Comment:
   Note: DataFileConstants.STANDARD_CODEC was added in [Avro 
1.9](https://github.com/apache/avro/blob/release-1.9.2/lang/java/avro/src/main/java/org/apache/avro/file/DataFileConstants.java#L41C30-L41C45),
 so I didn't want to reference it here and break 1.8 users. When Avro 1.8 is 
dropped it can be used directly



##########
sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/io/SerializableAvroCodecFactory.java:
##########
@@ -50,6 +50,9 @@ class SerializableAvroCodecFactory implements Externalizable {
   private static final Pattern deflatePattern = Pattern.compile(DEFLATE_CODEC 
+ "-(?<level>-?\\d)");
   private static final Pattern xzPattern = Pattern.compile(XZ_CODEC + 
"-(?<level>\\d)");
 
+  // Don't reference `DataFileConstants.ZSTANDARD_CODEC` directly for Avro 1.8 
compat
+  private static final Pattern zstdPattern = 
Pattern.compile("zstandard\\[(?<level>\\d+)\\]");

Review Comment:
   Note: `DataFileConstants.ZSTANDARD_CODEC` was added in [Avro 
1.9](https://github.com/apache/avro/blob/release-1.9.2/lang/java/avro/src/main/java/org/apache/avro/file/DataFileConstants.java#L41C30-L41C45),
 so I didn't want to reference it here and break 1.8 users. When Avro 1.8 is 
dropped it can be used directly



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to