Skip to content

Commit

Permalink
Use enhanced switch in ParquetCompressionUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed Nov 7, 2023
1 parent 7d664e1 commit bcb8af7
Showing 1 changed file with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,15 @@ public static Slice decompress(ParquetDataSourceId dataSourceId, CompressionCode
return EMPTY_SLICE;
}

switch (codec) {
case GZIP:
return decompressGzip(input, uncompressedSize);
case SNAPPY:
return decompressSnappy(input, uncompressedSize);
case UNCOMPRESSED:
return input;
case LZO:
return decompressLZO(input, uncompressedSize);
case LZ4:
return decompressLz4(input, uncompressedSize);
case ZSTD:
return decompressZstd(input, uncompressedSize);
case BROTLI:
case LZ4_RAW:
// unsupported
break;
}
throw new ParquetCorruptionException(dataSourceId, "Codec not supported in Parquet: %s", codec);
return switch (codec) {
case UNCOMPRESSED -> input;
case GZIP -> decompressGzip(input, uncompressedSize);
case SNAPPY -> decompressSnappy(input, uncompressedSize);
case LZO -> decompressLZO(input, uncompressedSize);
case LZ4 -> decompressLz4(input, uncompressedSize);
case ZSTD -> decompressZstd(input, uncompressedSize);
case BROTLI, LZ4_RAW -> throw new ParquetCorruptionException(dataSourceId, "Codec not supported in Parquet: %s", codec);
};
}

private static Slice decompressSnappy(Slice input, int uncompressedSize)
Expand Down

0 comments on commit bcb8af7

Please sign in to comment.