【问题标题】:In lapply(list(...), ._java_valid_object) : NAs introduced by coercion在 lapply(list(...), ._java_valid_object) :强制引入的 NA
【发布时间】:2015-02-24 17:49:18
【问题描述】:
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 提供值向量值,但是当我触发上述查询时,它会显示错误。

【问题讨论】:

  • > sapply(dat2,mode) 日期总计 "numeric" "numeric"
  • dat2

标签: r coercion


【解决方案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)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-30
    相关资源
    最近更新 更多