我试图用物化CTE创建一个查询,但我得到了一个语法错误(在这个例子中是用R,但问题与R无关,我希望...)。
抛出错误的查询如下所示(非常接近文档中给出的示例)
WITH avg_cte AS MATERIALIZED (
SELECT carrier, MEAN(dep_delay) AS avg_dep_delay
FROM flights
GROUP BY carrier
)
SELECT * FROM avg_cte
带有R的MWE看起来像这样
cc <- DBI::dbConnect(duckdb::duckdb())
DBI::dbWriteTable(cc, "flights", nycflights13::flights)
q <- "WITH avg_cte AS MATERIALIZED (
SELECT carrier, MEAN(dep_delay) AS avg_dep_delay
FROM flights
GROUP BY carrier
)
SELECT * FROM avg_cte
"
DBI::dbGetQuery(cc, q)
#> Error: Parser Error: syntax error at or near "MATERIALIZED"
#> LINE 1: WITH avg_cte AS MATERIALIZED (
1条答案
按热度按时间sczxawaw1#
MATERIALIZE
关键字是0.9.0中的新关键字,但当前的R包仍然只有0.8.1-3。“出血边缘”installation instructions应该允许在此期间安装0.9.0。