我有一个场景:外部配置单元分区表的配置单元数据类型更改为n1。执行以下步骤后,我没有得到数据。
我遵循以下步骤:
>>created new table n2 with new datatype
>>dynamically inserted data in n2 from original table n1
>>Then follows below steps to rename the table to original name :n1
>>ALTER TABLE n1 DROP IF EXISTS PARTITION (partition_date>'0');
>>hadoop fs -rm -r hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1/partition_date*/*
>>MSCK repair table n1;
>>DROP TABLE n1;
>>ALTER TABLE n2 RENAME TO n1;
>>hadoop fs -rm -r hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1/*
>>hadoop fs –mv hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n2/* hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1
>>MSCK repair table n1;
>>Alter table n1 SET LOCATION 'hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1' ;
MSCK repair table n1;
********,请让我知道,为什么我在重命名表后没有获取数据。
>> `MSCK REPAIR TABLE n1;`
>> `hadoop fs -ls -R hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1`
drwxrwx--x+ - hive hive 0 2018-08-31 02:42 hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1/partition_date=2017-11-28
-rwxrwx--x+ 3 hive hive 8205 2018-08-31 02:42 hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1/partition_date=2017-11-28/000000_0
drwxrwx--x+ - hive hive 0 2018-08-31 02:42 hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1/partition_date=2018-01-15
-rwxrwx--x+ 3 hive hive 7032 2018-08-31 02:42 hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1/partition_date=2018-01-15/000003_0
drwxrwx--x+ - hive hive 0 2018-08-31 02:42 hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1/partition_date=2018-08-09
-rwxrwx--x+ 3 hive hive 7143 2018-08-31 02:42 hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1/partition_date=2018-08-09/000002_0
drwxrwx--x+ - hive hive 0 2018-08-31 02:42 hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1/partition_date=2018-08-16
-rwxrwx--x+ 3 hive hive 7501 2018-08-31 02:42 hdfs://FajitaDevelopment/data/gfctwnsg/staging/hive/gfctwnsg_staging/n1/partition_date=2018-08-16/000001_0
=================================================
>>show partitions n1;
+----------------------------+--+
| partition |
+----------------------------+--+
| partition_date=2017-11-28 |
| partition_date=2018-01-15 |
| partition_date=2018-08-09 |
| partition_date=2018-08-16 |
+----------------------------+--+
==============================================
>> select count(*),partition_date from n1 group by partition_date;
+------+-----------------+--+
| _c0 | partition_date |
+------+-----------------+--+
+------+-----------------+--+
=========================================
****Here is the issue, it is not showing the data.****