Skip to content

Commit

Permalink
Use switch expression in IcebergAvroFileWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Jan 30, 2024
1 parent 7e62f24 commit 76bb60b
Showing 1 changed file with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import static io.trino.plugin.iceberg.IcebergAvroDataConversion.toIcebergRecords;
import static io.trino.plugin.iceberg.IcebergErrorCode.ICEBERG_WRITER_CLOSE_ERROR;
import static io.trino.plugin.iceberg.IcebergErrorCode.ICEBERG_WRITER_OPEN_ERROR;
import static io.trino.spi.StandardErrorCode.GENERIC_INTERNAL_ERROR;
import static java.util.Objects.requireNonNull;
import static org.apache.iceberg.TableProperties.AVRO_COMPRESSION;

Expand Down Expand Up @@ -135,19 +134,13 @@ public long getValidationCpuNanos()

private static String toIcebergAvroCompressionName(HiveCompressionCodec hiveCompressionCodec)
{
switch (hiveCompressionCodec) {
case NONE:
return "UNCOMPRESSED";
case SNAPPY:
return "SNAPPY";
case LZ4:
return "LZ4";
case ZSTD:
return "ZSTD";
case GZIP:
return "GZIP";
}
throw new TrinoException(GENERIC_INTERNAL_ERROR, "Unexpected hiveCompressionCodec: " + hiveCompressionCodec);
return switch (hiveCompressionCodec) {
case NONE -> "UNCOMPRESSED";
case SNAPPY -> "SNAPPY";
case LZ4 -> "LZ4";
case ZSTD -> "ZSTD";
case GZIP -> "GZIP";
};
}

@Override
Expand Down

0 comments on commit 76bb60b

Please sign in to comment.