问题
I am trying to execute insert into
query on impala table using rimpala.query()
function through R
but I am getting an error. The query that I am executing is:
for(x in nrow)
{
rite <- paste("INSERT INTO table1 (account_no, data_id, date_id, industry_no, sales_no, sales) VALUES (1445367,",data_frame1$data_id[x] ,",25,11346,23,", data_frame1$sales[x], ")",sep="")
sql <- rimpala.query(rite);
}
where data_frame1
is the data frame which has bunch of rows and nrow
is the number of rows in data_frame1
. The first insert into
statement executes and fist data is inserted into database but it throws an error just after executing that as
Error in rimpala.query(sql) : SQL error Error: The query did not generate a result set!
How do I remove this error?
回答1:
The error is in the RImpala client, which is using executeQuery to run all queries, even those that modify state. They should be using executeUpdate for DDL and INSERT, UPDATE, or DELETE queries. I've filed an issue upstream for you.
来源:https://stackoverflow.com/questions/25430351/forming-insert-into-query-using-rimpala-in-r