Hive报错之java.sql.SQLException: Field 'IS_STOREDASSUBDIRECTORIES' doesn't have a default value

时间:2023-03-09 09:47:51
Hive报错之java.sql.SQLException: Field 'IS_STOREDASSUBDIRECTORIES' doesn't have a default value

在创建表的时候报出如下错误:

hive> create table if not exists testfile_table(
> site string,
> url string,
> pv bigint,
> label string)
> row format delimited
> fields terminated by '\t'
> stored as textfile;
FAILED: Error in metadata: javax.jdo.JDODataStoreException: Insert of object "org.apache.hadoop.hive.metastore.model.MStorageDescriptor@5a75b5" using statement "INSERT INTO `SDS` (`SD_ID`,`OUTPUT_FORMAT`,`INPUT_FORMAT`,`CD_ID`,`SERDE_ID`,`NUM_BUCKETS`,`IS_COMPRESSED`,`LOCATION`) VALUES (?,?,?,?,?,?,?,?)" failed : Field 'IS_STOREDASSUBDIRECTORIES' doesn't have a default value
NestedThrowables:
java.sql.SQLException: Field 'IS_STOREDASSUBDIRECTORIES' doesn't have a default value
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

解决办法如下:

[root@node3 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.5.22-log Source distribution Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> alter table SDS alter column IS_STOREDASSUBDIRECTORIES set default 0;

再次创建表成功:

hive> create table if not exists testfile_table(
> site string,
> url string,
> pv bigint,
> label string)
> row format delimited
> fields terminated by '\t'
> stored as textfile;
OK
Time taken: 0.173 seconds

英文解释地址:http://mail-archives.apache.org/mod_mbox/hive-dev/201302.mbox/%3CJIRA.12631340.1360272250513.300651.1361168954618@arcas%3E