我正在使用 RJDBC 包连接到 Hive。
library(rJava)
library(RJDBC)
-
-
-
conn <- dbConnect(drv, "jdbc:hive2://ip:port","***", "****")
连接后,我键入此命令以查看表列表:
dbListTables(conn)
[1] "m_11" "m_12"
[3] "m_16" "m_18"
[5] "m_19" "m_20"
其他命令即
dbGetTables (conn, "m_11")
TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS
1 report m_11 TABLE <NA>
但是当我想读取表格时,它显示错误为“找不到表格”:
dbGetQuery(conn, "select * from m_11")
Error in .verify.JDBC.result(r, "Unable to retrieve JDBC result set for ", :
Unable to retrieve JDBC result set for select * from m_11 (Error while compiling statement: FAILED: SemanticException [Error 10001]: Line 1:14 Table not found 'm_11')
还,
d <- dbReadTable(conn, "m_11")
Error in .verify.JDBC.result(r, "Unable to retrieve JDBC result set for ", :
Unable to retrieve JDBC result set for SELECT * FROM "m_11" (Error while compiling statement: FAILED: ParseException line 1:14 cannot recognize input near '"m_11"' '<EOF>' '<EOF>' in join source)
我想知道以下命令:
a) 如何读取表,即 m_11
b) 通过“Consm_ID”合并两个表,即 m_11 和 m_12
有没有其他简单的替代方法可以在 R 中完成它。