1、hive使用mysql存储元数据,报错:hive> show tables;
FAILED: Error in metadata: javax.jdo.JDODataStoreException: Error(s) were found while auto-creating/validating the datastore for classes. The errors are printed in the log, and are attached to this exception.
NestedThrowables:
java.sql.SQLException: Can't create table 'hive.#sql-d7f_8' (errno: 121)
FAILED: Error in metadata: javax.jdo.JDODataStoreException: Error(s) were found while auto-creating/validating the datastore for classes. The errors are printed in the log, and are attached to this exception.
NestedThrowables:
java.sql.SQLException: Can't create table 'hive.#sql-d7f_8' (errno: 121)
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
原因分析:
a、在使用mysql存储元数据前,hdfs中包含有之前的hive表数据
b、mysql之前已经用于存储另一版本的hive的元数据,对应数据库下已经创建相应的表
问题解决:
a、删除hdfs上hive目录(默认/user/hive/warehourse)
b、删除mysql中hive数据库下所有表
2、hiveql中”NULL“字段用于where子句
select * from tbl where col !="";