關於Hive單表資料損壞的處理(版本0.7.0)
執行命令異常:
> desc ods_xxx;
FAILED: Error in metadata: at least one column must be specified for the tableFAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
根據網上介紹的方法,修改datanucleus.cache.level2.type引數為none問題仍存在;
檢視根據sd_id(12134)檢視元資料庫的columns表,發現對應ods_xxx列值為空;
解決方法:
1、修補元資料 表;
mysql> desc columns;
+-------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------+------+-----+---------+-------+
| SD_ID | bigint(20) | NO | PRI | NULL | |
| COMMENT | varchar(256) | YES | | NULL | |
| COLUMN_NAME | varchar(128) | NO | PRI | NULL | |
| TYPE_NAME | varchar(4000) | NO | | NULL | |
| INTEGER_IDX | int(11) | NO | | NULL | |
+-------------+---------------+------+-----+---------+-------+
mysql> insert into columns values(12134,"","id","int",0);
2、通過hive客戶端介面刪除表;
#hive -e "drop table ods_xxx";
3、重新執行建表指令碼;