wgtmac commented on code in PR #656:
URL: https://github.com/apache/iceberg-cpp/pull/656#discussion_r3271040420
##########
src/iceberg/parquet/parquet_writer.cc:
##########
@@ -45,21 +47,31 @@ Result<std::shared_ptr<::arrow::io::OutputStream>>
OpenOutputStream(
Result<::arrow::Compression::type> ParseCompression(const WriterProperties&
properties) {
const auto& compression_name =
properties.Get(WriterProperties::kParquetCompression);
+ ::arrow::Compression::type compression;
if (compression_name == "uncompressed") {
- return ::arrow::Compression::UNCOMPRESSED;
+ compression = ::arrow::Compression::UNCOMPRESSED;
} else if (compression_name == "snappy") {
- return ::arrow::Compression::SNAPPY;
+ compression = ::arrow::Compression::SNAPPY;
} else if (compression_name == "gzip") {
- return ::arrow::Compression::GZIP;
+ compression = ::arrow::Compression::GZIP;
} else if (compression_name == "brotli") {
- return ::arrow::Compression::BROTLI;
+ compression = ::arrow::Compression::BROTLI;
} else if (compression_name == "lz4") {
- return ::arrow::Compression::LZ4;
+ compression = ::arrow::Compression::LZ4;
} else if (compression_name == "zstd") {
- return ::arrow::Compression::ZSTD;
+ compression = ::arrow::Compression::ZSTD;
} else {
return InvalidArgument("Unsupported Parquet compression codec: {}",
compression_name);
}
+ return compression;
Review Comment:
Updated `ParseCompression` to use early returns again while keeping the
availability check after parsing.
##########
src/iceberg/test/parquet_test.cc:
##########
@@ -124,6 +128,27 @@ void DoRoundtrip(std::shared_ptr<::arrow::Array> data,
std::shared_ptr<Schema> s
ASSERT_TRUE(out != nullptr) << "Reader.Next() returned no data";
}
+struct ParquetCodec {
+ std::string name;
+ ::arrow::Compression::type compression;
+};
+
+std::optional<ParquetCodec> UnavailableParquetCodec() {
Review Comment:
Renamed the helper to `FirstUnavailableParquetCodec` to match the
first-match behavior.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]