本文介绍了在R中使用Rimpala在查询中形成插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过R使用rimpala.query()函数在impala表上执行insert into查询,但是出现错误.我正在执行的查询是:

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);

}

其中,data_frame1是具有一堆行的数据帧,而nrowdata_frame1中的行数.第一个insert into语句执行并将第一笔数据插入数据库,但是在执行完后立即抛出错误

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!

如何清除此错误?

推荐答案

错误出现在 RImpala 中客户端,该客户端正在使用 executeQuery 即可运行所有查询,即使是那些修改状态的查询.他们应该使用对DDL和INSERT,UPDATE或DELETE查询执行executeUpdate .我已经向您上游提交了问题.

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.

这篇关于在R中使用Rimpala在查询中形成插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 08:18