Skip to content

Commit 1f2d4b1

Browse files
committed
fix: Correctly handle missing values in if_else()
1 parent 59366d9 commit 1f2d4b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

R/relational-duckdb.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ duckplyr_macros <- c(
3838
# "as.Date" = '(x) AS strptime(x, \'%Y-%m-%d\')',
3939

4040
"grepl" = "(pattern, x) AS (CASE WHEN x IS NULL THEN FALSE ELSE regexp_matches(x, pattern) END)",
41-
"if_else" = "(test, yes, no) AS (CASE WHEN test THEN yes ELSE no END)",
41+
"if_else" = "(test, yes, no) AS (CASE WHEN test IS NULL THEN NULL ELSE CASE WHEN test THEN yes ELSE no END END)",
4242
"|" = "(x, y) AS (x OR y)",
4343
"&" = "(x, y) AS (x AND y)",
4444
"!" = "(x) AS (NOT x)",

0 commit comments

Comments
 (0)