我正在尝试使用Hive自定义项 date_format()
提取一周中的某一天,但它只返回 NA
. 让我们看一个例子
sc <- sparklyr::spark_connect(master = "local")
df <- dplyr::copy_to(
sc,
data.frame(date = as.POSIXct("2020-01-01")),
"df"
)
df
# # Source: spark<df> [?? x 1]
# date
# <dttm>
# 1 2019-12-31 23:00:00
# Extracting the year works fine...
dplyr::mutate_at(
.tbl = df,
.vars = "date",
.funs = ~date_format(., "yyyy")
)
# # Source: spark<?> [?? x 1]
# date
# <chr>
# 1 2020
# But extracting the day of the week does not...
dplyr::mutate_at(
.tbl = df,
.vars = "date",
.funs = ~date_format(., "E")
)
# # Source: spark<?> [?? x 1]
# date
# <chr>
# 1 NA
任何帮助都将不胜感激。一些系统信息:
mac os 10.15.7版
Spark3.0.1
第1.5.1条
暂无答案!
目前还没有任何答案,快来回答吧!