我想将 R 中的数据框写入 Hadoop Hive 中的新表。我在 RODBC 包中使用 sqlSave(),如下所示。表结构是在 Hadoop 中创建的,但是在将任何数据插入表之前我得到一个错误。错误消息包含在下面。有关如何将 R 中的数据框写入 Hadoop 中的新表的任何建议?
代码
column_1 = c("a","b","c")
column_2 = c("d","e","f")
column_3 = c("g","h","i")
test.df = data.frame(column_1,column_2,column_3)
columnTypes <- list(column_1='varchar(255)',
column_2='varchar(255)',
column_3='varchar(255)')
sqlSave(dbConn, test.df, 'db.tablename', verbose=T, append=T, rownames = F, fast = F, varTypes = columnTypes)
错误信息
Query: CREATE TABLE db.tablename ("column_1" varchar(255), "column_2" varchar(255), "column_3" varchar(255))
Query: INSERT INTO db.tablename ( "column_1", "column_2", "column_3" ) VALUES ( 'a', 'd', 'g' )
Error in sqlSave(dbConn, test.df, "db.tablename", verbose = T, :
[Microsoft][HiveODBC] (55) Insert operation is not support for table: HIVE.db.tablename
[RODBC] ERROR: Could not SQLExecDirect 'INSERT INTO db.tablename ( "column_1", "column_2", "column_3" ) VALUES ( 'a', 'd', 'g' )'