Search code examples
hiveimpala

No partitions selected for incremental stats update


Getting a message No partitions selected for incremental stats update when I run COMPUTE INCREMENTAL STATS <table_name> without partition clause in the command. But the table is partitioned with some column.

As per the documentation here COMPUTE INCREMENTAL STATS [db_name.]table_name [PARTITION (partition_spec)] PARTITION clause is optional.

then I don't understand why I'm getting an err that "No partitions selected". Is it mandatory or any different versions available ? Please help


Solution

  • Your understanding is correct PARTITION clause is optional. and this is correct behavior of COMPUTE INCREMENTAL STATS.
    Incremental stats gather stats as usual but if it finds a new partition, it gather stats and show message that it found a new partition and gather stats for that.

    When you run COMPUTE INCREMENTAL STATS mytab for the first time, it will gather all the stats of all partitions and you will see message like Updated 4 partition(s) and 200 column(s)..
    When you run COMPUTE INCREMENTAL STATS mytab again (without adding new partition), it doesn't find any new partition to gather stats. So it will show this message No partitions selected for incremental stats update. and gather stats of existing data.