r.gl
r.gl

Reputation: 41

How to control output files size in Spark Structured Streaming

We're considering using Spark Structured Streaming on a project. The input and output are parquet files on S3 bucket. Is it possible to control the size of the output files somehow? We're aiming at output files of size 10-100MB. As I understand, in traditional batch approach we could determine the output file sizes by adjusting the amount of partitions according to the size of the input dataset, is something similar possible in Structured Streaming?

Upvotes: 4

Views: 7243

Answers (1)

user10938362
user10938362

Reputation: 4151

In Spark 2.2 or later the optimal option is to set spark.sql.files.maxRecordsPerFile

spark.conf.set("spark.sql.files.maxRecordsPerFile", n)

where n is tuned to reflect an average size of a row.

See

Upvotes: 6

Related Questions