You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/02/10 02:38:00 UTC
[GitHub] [iceberg] amogh-jahagirdar commented on a change in pull request #4083: Core: Add support for writing and reading ZSTD Avro Data
amogh-jahagirdar commented on a change in pull request #4083:
URL: https://github.com/apache/iceberg/pull/4083#discussion_r803254080
##########
File path: core/src/main/java/org/apache/iceberg/avro/Avro.java
##########
@@ -217,17 +200,40 @@ static Context deleteContext(Map<String, String> config) {
Context dataContext = dataContext(config);
String codecAsString = config.get(DELETE_AVRO_COMPRESSION);
- CodecFactory codec = codecAsString != null ? toCodec(codecAsString) : dataContext.codec();
+ CodecFactory codec = codecAsString != null ? toCodec(codecAsString, config) : dataContext.codec();
return new Context(codec);
}
- private static CodecFactory toCodec(String codecAsString) {
+ private static CodecFactory toCodec(String codecAsString, Map<String, String> config) {
+ CodecFactory codecFactory = null;
try {
- return CodecName.valueOf(codecAsString.toUpperCase(Locale.ENGLISH)).get();
+ switch (Codec.valueOf(codecAsString.toUpperCase(Locale.ENGLISH))) {
+ case UNCOMPRESSED:
+ codecFactory = CodecFactory.nullCodec();
+ break;
+ case SNAPPY:
+ codecFactory = CodecFactory.snappyCodec();
+ break;
+ case ZSTD:
+ codecFactory = CodecFactory.zstandardCodec(PropertyUtil.propertyAsInt(config,
+ AVRO_ZSTD_COMPRESSION_LEVEL,
+ AVRO_ZSTD_COMPRESSION_LEVEL_DEFAULT));
+ break;
+ case GZIP:
+ codecFactory = CodecFactory.deflateCodec(9);
+ break;
+ case LZ4:
+ break;
Review comment:
Ah yes, I had this fixed locally but didn't update my commit. The updated test will fail with an NPE when we set the codec if we don't fix this.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org