Skip to content

na_matches = "na" doesn't work for DuckDB #704

@mgirlich

Description

@mgirlich
library(dbplyr)
library(dplyr, warn.conflicts = FALSE)

con <- DBI::dbConnect(duckdb::duckdb())
x <- copy_to(
  src_dbi(con),
  tibble(x = 1),
  name = "dummy"
)
left_join(x, x, by = "x", na_matches = "na") %>% 
  show_query()
#> <SQL>
#> SELECT "LHS"."x" AS "x"
#> FROM "dummy" AS "LHS"
#> LEFT JOIN "dummy" AS "RHS"
#> ON (CASE WHEN ("LHS"."x" = "RHS"."x") OR ("LHS"."x" IS NULL AND "RHS"."x" IS NULL) THEN 0 ELSE 1 = 0)
left_join(x, x, by = "x", na_matches = "na")
#> Error in .local(conn, statement, ...): duckdb_prepare_R: Failed to prepare query SELECT *
#> FROM (SELECT "LHS"."x" AS "x"
#> FROM "dummy" AS "LHS"
#> LEFT JOIN "dummy" AS "RHS"
#> ON (CASE WHEN ("LHS"."x" = "RHS"."x") OR ("LHS"."x" IS NULL AND "RHS"."x" IS NULL) THEN 0 ELSE 1 = 0)
#> ) "q01"
#> LIMIT 11
#> Error: Parser Error: syntax error at or near ")"
#> LINE 5: ...LEFT JOIN "dummy" AS "RHS"
#> ON (CASE WHEN ("LHS"."x" = "RHS"."x") OR ("LHS"."x" IS NULL AND "RHS"."x" IS NULL) THEN 0 ELSE 1 = 0)
#>                                                   ^

Created on 2021-09-17 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions