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

hive>createtableifnotexists testfile_table(
> site string,
> url string,
>pvbigint,
> label string)
> row format delimited
>fields terminatedby'\t'>storedas textfile;
FAILED: Error inmetadata: javax.jdo.JDODataStoreException:Insertofobject "org.apache.hadoop.hive.metastore.model.MStorageDescriptor@5a75b5" using statement "INSERTINTO`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 adefault value
FAILED: Execution Error, returncode1fromorg.apache.hadoop.hive.ql.exec.DDLTask

解决办法如下:

[root@node3 ~]# mysql-u root-p
Enter password:
Welcome tothe MySQL monitor. Commandsendwith;or \g.
Your MySQL connection id is17Server version: 5.5.22-log Source distribution
Copyright (c) 2000,2011, Oracleand/orits affiliates.All rights reserved.
Oracle isa registered trademarkofOracle Corporationand/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;'or'\h'forhelp. Type'\c'toclear thecurrent input statement.
mysql>altertableSDSaltercolumnIS_STOREDASSUBDIRECTORIESsetdefault0;

再次创建表成功:

hive>createtableifnotexists testfile_table(
> site string,
> url string,
>pvbigint,
> label string)
> row format delimited
>fields terminatedby'\t'>storedas textfile;
OK
Time taken: 0.173seconds

英文解释地址:http://mail-archives.apache.org/mod_mbox/hive-dev/201302.mbox/%3CJIRA.12631340.1360272250513.300651.1361168954618@arcas%3E
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2730/viewspace-3126215/ ,如需转载,请注明出处,否则将追究法律责任。