0

I have an external hive table which has partitions like year = 2017, year = 2018 and inside them I've partitions for each month for year = 2017 and year = 2018 as well.

My questions are:

  1. If I drop partition year = 2017, will it drop all the month partitions for year = 2017?

  2. what will happen in case of internal tables?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Amol.Shaligram
  • 713
  • 1
  • 5
  • 12

1 Answers1

0

Yes, hive drops all the month partitions/sub partititons including data in file system(HDFS..etc) inside year=2017 in case of internal tables.

In case of external tables data will not be dropped from file system(HDFS) but hive drops the partition information from hive table metadata.

notNull
  • 30,258
  • 4
  • 35
  • 50
  • Thanks @Shu. Also one more doubt is if I delete the 2017 HDFS directory directly without running the drop partition command on hive CLI, will the changes get reflected in table also automatically ? Also will it cause any kind of issues in hive meratada store (which is derby i guess). – Amol.Shaligram Jul 06 '18 at 05:13
  • If we delete hdfs directly even if the table is external/internal table doesn't matter hive doesn't know about the dropped directories until we run msck repair table/drop partition statement from hive. The issue will be job will fail to find the directory(which is dropped already in HDFS) – notNull Jul 06 '18 at 13:29