Help Center/ MapReduce Service/ Troubleshooting/ Using Spark/ Why Are Table Statistics Empty Before Data Insertion for New Hudi or Hive Tables Created Using Spark SQL?
Updated on 2026-10-21 GMT+08:00

Why Are Table Statistics Empty Before Data Insertion for New Hudi or Hive Tables Created Using Spark SQL?

Symptom

When Spark SQL is used to create Hudi or Hive tables, the table statistics are empty before data is inserted.

Procedure

You can use either of the following methods to collect the statistics:

  1. Run the analyze command to trigger statistics collection. If no data is inserted, run the desc formatted table_name command to check whether the value of totalsize is 0 after the analyze command is executed.
  2. Set spark.sql.statistics.size.autoUpdate.enabled to true and insert data. Statistics collection will be triggered in the background.