Apache Hive MSCK REPAIR TABLE neue Partition nicht hinzugefügt

Ich bin neu bei Apache Hive. Wenn ich bei der Arbeit an einer externen Tabellenpartition eine neue Partition direkt zu HDFS hinzufüge, wird die neue Partition nach dem Ausführen der MSCK REPAIR-Tabelle nicht hinzugefügt. Unten sind die Codes, die ich versucht habe,

- Externe Tabelle erstellen

hive> create external table factory(name string, empid int, age int) partitioned by(region string)  
    > row format delimited fields terminated by ','; 

- Detaillierte Tabelleninformationen

Location:  hdfs://localhost.localdomain:8020/user/hive/warehouse/factory     
Table Type:             EXTERNAL_TABLE           
Table Parameters:        
    EXTERNAL                TRUE                
    transient_lastDdlTime   1438579844  

- Erstellen eines Verzeichnisses in HDFS zum Laden von Daten für die Tabellenfactory

[cloudera@localhost ~]$ hadoop fs -mkdir 'hdfs://localhost.localdomain:8020/user/hive/testing/testing1/factory1'
[cloudera@localhost ~]$ hadoop fs -mkdir 'hdfs://localhost.localdomain:8020/user/hive/testing/testing1/factory2'

- Tabellendaten

cat factory1.txt
emp1,500,40
emp2,501,45
emp3,502,50

cat factory2.txt
EMP10,200,25
EMP11,201,27
EMP12,202,30

- Kopieren von lokal nach HDFS

[cloudera@localhost ~]$ hadoop fs -copyFromLocal '/home/cloudera/factory1.txt' 'hdfs://localhost.localdomain:8020/user/hive/testing/testing1/factory1'
[cloudera@localhost ~]$ hadoop fs -copyFromLocal '/home/cloudera/factory2.txt' 'hdfs://localhost.localdomain:8020/user/hive/testing/testing1/factory2'

- Ändern der zu aktualisierenden Tabelle im Metastore

hive> alter table factory add partition(region='southregion') location '/user/hive/testing/testing1/factory2';
hive> alter table factory add partition(region='northregion') location '/user/hive/testing/testing1/factory1';            
hive> select * from factory;                                                                      
OK
emp1    500 40  northregion
emp2    501 45  northregion
emp3    502 50  northregion
EMP10   200 25  southregion
EMP11   201 27  southregion
EMP12   202 30  southregion

Nun habe ich eine neue Datei factory3.txt erstellt, um sie als neue Partition für die Tabellenfactory hinzuzufügen

cat factory3.txt
user1,100,25
user2,101,27
user3,102,30

- Pfad erstellen und Tabellendaten kopieren

[cloudera@localhost ~]$ hadoop fs -mkdir 'hdfs://localhost.localdomain:8020/user/hive/testing/testing1/factory2'
[cloudera@localhost ~]$ hadoop fs -copyFromLocal '/home/cloudera/factory3.txt' 'hdfs://localhost.localdomain:8020/user/hive/testing/testing1/factory3'

Jetzt habe ich die folgende Abfrage ausgeführt, um den Metastore für die neue hinzugefügte Partition zu aktualisieren.

MSCK REPAIR TABLE factory;

Nun gibt die Tabelle den neuen Partitionsinhalt der Factory3-Datei nicht an. Kann ich wissen, wo ich Fehler beim Hinzufügen einer Partition für die Tabellenfactory mache?

Wenn ich den Befehl alter ausführe, werden die neuen Partitionsdaten angezeigt.

hive> alter table f,actory add partition(region='eastregion') location '/user/hive/testing/testing1/factory3';

Kann ich wissen, warum der Befehl MSCK REPAIR TABLE nicht funktioniert?

Antworten auf die Frage(4)

Ihre Antwort auf die Frage