a[1]
[1] "AA"
> rhive.query("select count( uniquecarrier) from f08 where uniquecarrier= '",a[1] ," ' ")
Error: java.sql.SQLException: Query returned non-zero code: 40000, cause: FAILED: ParseException line 1:61 cannot recognize input near '<EOF>' '<EOF>' '<EOF>' in expression specification
In addition: Warning messages:
1: In lapply(list(...), ._java_valid_object) : NAs introduced by coercion
2: In lapply(list(...), ._java_valid_object) : NAs introduced by coercion
我想为rhive提供值向量值,但是当我触发上面的查询时,它会显示错误。
答案 0 :(得分:1)
您将查询作为单独的参数提供给rhive.query
,这不起作用(该命令必须是first argument)。你需要先paste0
他们在一起:
cmd <- paste0("select count( uniquecarrier) from f08 where uniquecarrier= '", a[1] , "'")
cmd
# [1] "select count( uniquecarrier) from f08 where uniquecarrier= 'AA'"
rhive.query(cmd)