1.数据库的命名不能用数字开头
0: jdbc:hive2://192.168.171.151:10000> create database 0328;#不区分大小写字母
Error: Error while compiling statement: FAILED: ParseException line 1:16 cannot recognize input near '0328' '<EOF>' '<EOF>' in create database statement (state=42000,code=40000)
0: jdbc:hive2://192.168.171.151:10000> #这段代码表达数据库命名不能用数字开头
2.分区表数据文件一定要存储在某个分区中,而不能直接存储在表中
0: jdbc:hive2://192.168.171.151:10000> load data local inpath '/usr/word/dept.txt'
. . . . . . . . . . . . . . . . . . > into table dept_part;
Error: Error while compiling statement: FAILED: SemanticException [Error 10062]: Need to specify partition columns because the destination table is partitioned (state=42000,code=10062)
#没有指定分区
3.创建表数据类型错误
0: jdbc:hive2://192.168.171.151:10000> CREATE external TABLE students
. . . . . . . . . . . . . . . . . . > (id INT,NAME STRING,sex CHAR)
. . . . . . . . . . . . . . . . . . > partitioned BY(city STRING)
. . . . . . . . . . . . . . . . . . > ROW FORMAT delimited FIELDS
. . . . . . . . . . . . . . . . . . > TERMINATED BY ','
. . . . . . . . . . . . . . . . . . > location '/hive/students';
Error: Error while compiling statement: FAILED: ParseException line 2:28 mismatched input ')' expecting ( near 'CHAR' in primitive type specification (state=42000,code=40000)
#性别char改成string就可以了
4.导入数据要用partition,不要用partitioned
0: jdbc:hive2://192.168.171.151:10000> load data local inpath '/usr/word.students.txt'
. . . . . . . . . . . . . . . . . . > into table students
. . . . . . . . . . . . . . . . . . > partitioned(city="beijing");
Error: Error while compiling statement: FAILED: ParseException line 3:0 missing EOF at 'partitioned' near 'students' (state=42000,code=40000)
#用错单词
5.数据库关键字不能做表名
0: jdbc:hive2://192.168.171.151:10000> create table order
. . . . . . . . . . . . . . . . . . > (id int,ord_num string)
. . . . . . . . . . . . . . . . . . > partitioned by(month string)
. . . . . . . . . . . . . . . . . . > row format delimited fields
. . . . . . . . . . . . . . . . . . > terminated by '\t';
Error: Error while compiling statement: FAILED: ParseException line 1:13 Failed to recognize predicate 'order'. Failed rule: 'identifier' in table name (state=42000,code=40000) #order是关键字
6.数据库没有找到表
Error while compiling statement: FAILED: SemanticException [Error 10001]: Line 1:33 Table not found 'admin'