Fixing statistics

Upgrading from Hive 1 or Hive 2 to Hive 3 might result in missing statistics. In Hive 3, these missing statistics, when detected by the cost-based optimizer (CBO), could cause datasets to be disregarded. As Data Engineer, you need to fix these statistics after upgrading.

  1. Run DESCRIBE FORMATTED <table>, and check the value of numrows.
    If the value is 0, you must fix statistics.
  2. Run ANALYZE on the tables and columns to fix the statistics.
    ANALYZE TABLE credit_card_01.cc_acct COMPUTE STATISTICS[FOR COLUMNS];