cshuo commented on code in PR #19781:
URL: https://github.com/apache/hudi/pull/19781#discussion_r3912743969
##########
hudi-hadoop-common/src/main/java/org/apache/hudi/common/util/ParquetUtils.java:
##########
@@ -87,13 +92,58 @@
import static
org.apache.parquet.avro.HoodieAvroParquetSchemaConverter.getAvroSchemaConverter;
import static
org.apache.parquet.format.converter.ParquetMetadataConverter.NO_FILTER;
import static
org.apache.parquet.format.converter.ParquetMetadataConverter.SKIP_ROW_GROUPS;
+import static
org.apache.parquet.hadoop.codec.ZstandardCodec.PARQUET_COMPRESS_ZSTD_LEVEL;
/**
* Utility functions involving with parquet.
*/
@Slf4j
public class ParquetUtils extends FileFormatUtils {
+ /**
+ * Prepares the storage and Hudi configurations used by a Parquet writer.
Built-in writer configuration
+ * overrides are applied first so that the user-provided config injector
remains the highest-priority extension point.
+ */
+ public static Pair<StorageConfiguration, HoodieConfig>
prepareParquetWriterConfigs(
+ StoragePath path, StorageConfiguration storageConf, HoodieConfig
hoodieConfig) {
+ StorageConfiguration nativeLogStorageConf =
+ applyNativeLogZstdCompressionLevel(path, storageConf, hoodieConfig);
+ return HoodieParquetConfigInjector.applyConfigInjector(path,
nativeLogStorageConf, hoodieConfig);
+ }
+
+ /**
+ * Returns a storage configuration with the native Parquet log ZSTD
compression level applied.
+ * The input configuration is copied only when its ZSTD level is absent or
differs from the native log level,
+ * so base file writers and other users of the shared configuration are not
affected.
+ */
+ public static <T> StorageConfiguration<T> applyNativeLogZstdCompressionLevel(
Review Comment:
Fixed in 0d0fe351ea9. Renamed the helper to
injectDefaultZstdCompressionLevel and updated the related tests and
documentation.
--
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]