From a8f1d4e7d03275352171921ad29faced628d1279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 4 May 2024 20:24:10 +0200 Subject: [PATCH] Convert NA to macro, https://github.com/duckdb/duckdb-r/pull/156 --- R/relational-duckdb.R | 3 +++ R/relational.R | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/R/relational-duckdb.R b/R/relational-duckdb.R index b3139c9b..5af09280 100644 --- a/R/relational-duckdb.R +++ b/R/relational-duckdb.R @@ -15,6 +15,9 @@ get_default_duckdb_connection <- function() { } duckplyr_macros <- c( + # https://github.com/duckdb/duckdb-r/pull/156 + "___null" = "() AS CAST(NULL AS BOOLEAN)", + "<" = '(x, y) AS "r_base::<"(x, y)', "<=" = '(x, y) AS "r_base::<="(x, y)', ">" = '(x, y) AS "r_base::>"(x, y)', diff --git a/R/relational.R b/R/relational.R index 7d32bca1..cfd4ecf7 100644 --- a/R/relational.R +++ b/R/relational.R @@ -118,9 +118,10 @@ rel_translate <- function( switch(typeof(expr), character = , - logical = , integer = , double = relexpr_constant(expr), + # https://github.com/duckdb/duckdb-r/pull/156 + logical = if (is.na(expr)) relexpr_function("___null", list()) else relexpr_constant(expr), # symbol = { if (as.character(expr) %in% names_forbidden) {