tongwaiazuma commented on code in PR #37263:
URL: https://github.com/apache/spark/pull/37263#discussion_r1615796218
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFileFormat.scala:
##########
@@ -126,6 +127,15 @@ class ParquetFileFormat
// Sets compression scheme
conf.set(ParquetOutputFormat.COMPRESSION,
parquetOptions.compressionCodecClassName)
+ // Sets Zstd level and Zstd workers, only effect when compression codec is
`zstd`
+ conf.set(
Review Comment:
> You can use `setIfUnset` I believe. The main problem is that I am not sure
if it's worthwhile. For example, we don't expose a configuration for Parquet
writer v2 (e.g., `parquet.writer.version`).
>
> Just for clarification, you are already able to set this via, e.g.:
>
> ```
> val spark = SparkSession.
> builder()
> .master("local[*]")
> .appName("AppName")
> .config("spark.sql.parquet.compression.codec", "zstd")
> .getOrCreate()
> spark.sessionState.newHadoopConfWithOptions(
> "parquet.compression.codec.zstd.level" -> "10",
> "parquet.compression.codec.zstd.workers" -> "0"
> )
> val csvfile = spark.read.csv("file:///home/test_data/Reviews.csv")
> csvfile.coalesce(1).write.parquet("file:///home/test_data/nn_parq_10")
> ```
>
> I believe?
Hi @HyukjinKwon, I believe the provided way works.
However, there is no way to modify the
`parquet.compression.codec.zstd.{level|worker}` configs dynamically during
spark runtime, right?
In my usage, I have a long-running spark app, that needs to increase the
compression level if some conditions are met.
Do you guys have any suggestions?
Some example code in spark-shell
```
// bin/spark-shell
val f = spark.read.parquet("file:///tmp/input_imp_join_all.zstd.parquet")
f.sparkSession.sessionState.conf.setConfString("parquet.compression.codec.zstd.level",
"3")
f.coalesce(1).write.parquet("file:///tmp/exp_level3")
f.sparkSession.sessionState.conf.setConfString("parquet.compression.codec.zstd.level",
"6")
f.coalesce(1).write.parquet("file:///tmp/expp_level6") // this won't be
level 6
```
--
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]