FAILED: ParseException line 1:17 cannot recognize input near 'student2' 'select' 'id' in destination specification

发布时间 2023-12-10 21:49:55作者: 会飞的猪仔

 

hive向表中插入数据时报错:

FAILED: ParseException line 1:17 cannot recognize input near 'student2' 'select' 'id' in destination specification

错误:

insert overwrite student2 select id,name from student;

正确:

insert overwrite table student2 select id,name from student;

 

语法:
INSERT (INTO | OVERWRITE) TABLE tablename [PARTITION (partcol1[=val1], partcol2[=val2] ...)] VALUES values_row [, values_row ...]

 但是在使用into插入数据时,是可以省略table的(可写可不写),但是使用overwrite需要写table关键字。

例子:
insert into student2 values(55,'22');
insert into table student2 values(55,'22');
效果一样