Help Center/ MapReduce Service/ Component Operation Guide (LTS)/ Using Spark/Spark2x/ Spark Core Enterprise-Class Enhancements/ Configuring the Number of Tasks for Spark to Read ORC and Parquet Files
Updated on 2026-08-29 GMT+08:00

Configuring the Number of Tasks for Spark to Read ORC and Parquet Files

Scenarios

When Spark reads ORC and Parquet files, you can control the number of reading tasks by specifying the value of SplitBytes and compression ratio. This feature prevents reading tasks for ORC and Parquet files from increasing with the number of available Executors, thereby reducing invalid tasks, relieving scheduling pressure of Driver tasks, and improving overall performance of Driver in heavy-load scenarios.

Notes and Constraints

  • This section applies only to MRS 3.6.0-LTS.1 and later.
  • Supported table types: DataSource tables, ORC Hive tables (supported when spark.sql.hive.convertMetastoreOrc is set to true), and Parquet Hive tables (supported when spark.sql.hive.convertMetastoreParquet is set to true)
  • Supported data formats: Parquet and ORC

Configuring Parameters

Modify the following parameters in the {Client installation directory}/Spark/spark/conf/spark-defaults.conf file on the Spark client.

Parameter

Parameters

Default Value

spark.sql.orc.resourceFriendly.split.mode.enabled

Whether to use SplitBytes and compression rate to control the number of reading tasks when Spark reads ORC files.

  • true: The ORC files are split according to the value of spark.sql.preset.orc.stripe.size and then read if there are sufficient resources.
  • false: SplitBytes and compression rate are not used to control the number of reading tasks.

false

spark.sql.preset.orc.stripe.size

Recommended value of orc.stripe.size for Spark to read ORC files

64 MB

spark.sql.orc.fileCompressionFactor

Size of the compressed stripe in the ORC file/Value of orc.stripe.size. The size of the compressed stripe in the ORC file varies depending on data.

1.0

spark.sql.parquet.resourceFriendly.split.mode.enabled

Whether to use SplitBytes and compression rate to control the number of reading tasks when Spark reads Parquet files.

  • true: The Parquet files are split according to the value of spark.sql.preset.parquet.block.size and then read if there are sufficient resources.
  • false: SplitBytes and compression rate are not used to control the number of reading tasks.

false

spark.sql.preset.parquet.block.size

Recommended value of parquet.block.size for Spark to read Parquet files

128 MB

spark.sql.parquet.fileCompressionFactor

Size of the compressed row group in the Parquet file/Value of parquet.block.size. The size of the compressed row group in the Parquet file varies depending on the data.

1.0

Calculation Logic of SplitBytes During File Reading

  • In the case of insufficient available resources, the files are split based on the value of SplitBytes calculated according to the available resources.
  • When spark.sql.orc.resourceFriendly.split.mode.enabled is set to true, the value of SplitBytes is calculated as follows during ORC file reading:
    orcStripSize = spark.sql.preset.orc.stripe.size * spark.sql.orc.fileCompressionFactor

    The final value of SplitBytes = Math.max (SplitBytes calculated based on available resources, orcStripSize)

  • When spark.sql.parquet.resourceFriendly.split.mode.enabled is set to true, the value of SplitBytes is calculated as follows during Parquet file reading:
    parquetBlockSize = spark.sql.preset.parquet.block.size * spark.sql.parquet.fileCompressionFactor

    The final value of SplitBytes = Math.max (SplitBytes calculated based on available resources, parquetBlockSize)