spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lienhart, Pierre (DI IZ) - AF (ext)" <>
Subject RE: [Spark SQL] Does Spark group small files
Date Wed, 14 Nov 2018 08:31:29 GMT
Hello Yann,

From my understanding, when reading small files Spark will group them and load the content
of each batch into the same partition so you won’t end up with 1 partition per file resulting
in a huge number of very small partitions. This behavior is controlled by the spark.files.maxPartitionBytes
parameter set to 128 MiB by default. For example if you have only 8 MiB files on your file
system, you will end up with partitions holding the content of 16 files. If your files are
heavily compressed, it can result in pretty fat partitions of size spark.files.maxPartitionBytes/compression

I can’t give you a link to a specific source code snippet but this is my experience from
working with a lot of small parquet files.



De : Yann Moisan []
Envoyé : mardi 13 novembre 2018 21:28
À :
Objet : [Spark SQL] Does Spark group small files


I'm using Spark 2.3.1.

I have a job that reads 5.000 small parquet files into s3.

When I do a mapPartitions followed by a collect, only 278 tasks are used (I would have expected
5000). Does Spark group small files ? If yes, what is the threshold for grouping ? Is it configurable
? Any link to corresponding source code ?




Accédez aux meilleurs tarifs Air France, gérez vos réservations et enregistrez-vous en
ligne sur
Find best Air France fares, manage your reservations and check in online at

Les données et renseignements contenus dans ce message peuvent être de nature confidentielle
et soumis au secret professionnel et sont destinés à l'usage exclusif du destinataire dont
les coordonnées figurent ci-dessus. Si vous recevez cette communication par erreur, nous
vous demandons de ne pas la copier, l'utiliser ou la divulguer. Nous vous prions de notifier
cette erreur à l'expéditeur et d'effacer immédiatement cette communication de votre système.
Société Air France - Société anonyme au capital de 126 748 775 euros - RCS Bobigny (France)
420 495 178 - 45, rue de Paris, Tremblay-en-France, 95747 Roissy Charles de Gaulle CEDEX
The data and information contained in this message may be confidential and subject to professional
secrecy and are intended for the exclusive use of the recipient at the address shown above.
If you receive this message by mistake, we ask you not to copy, use or disclose it. Please
notify this error to the sender immediately and delete this message from your system. Société
Air France - Limited company with capital of 126,748,775 euros - Bobigny register of companies
(France) 420 495 178 - 45, rue de Paris, Tremblay-en-France, 95747 Roissy Charles de Gaulle
Pensez à l'environnement avant d'imprimer ce message.
Think of the environment before printing this mail.
View raw message