Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Problem inserting data into hive table using jdbc

avatar
New Contributor

I have a problems inserting data in a hive table, i'm using Amazon JDBC (AmazonHiveJDBC-2.6.19.1022), I test with Cloudera JDBS too.

create table sf1 (c1 string, c2 string, c3 string, c4 string, c5 string, c6 string, c7 string);

Then i try to insert into that table (using any GUI, ex. DBvisualizer) data as follows

insert into sf1 (c1,c2,c3,c4,c5,c6,c7) values ('1','2','3','4','5','6','7')

but i get:

ERROR: Code:40000, Sql State: 42000 error while compiling statement: FAILED: SemanticException 0:0 Expected 7 columns for insclause-0/default@sf1; select produces 1 columns. Error encountered near token "7"

[Code 40000, SQL State: 42000][...Expected 7 columns ...; select produces 1 columns. Error encounterednear token "7"]

 

errorInsertandoEnHive.png

 

I have no problem inserting with the same clause using hive command line.

1 REPLY 1

avatar
Super Collaborator

Hi @Lobitojc ,

 

It seems to be a Hive BUG please refer the below Jira:

https://issues.apache.org/jira/browse/HIVE-24998

 

Regards,

Chethan YM