From b6303f17ced2e267a6c10aee9cd3401c6f9f4f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 9 Mar 2024 06:20:46 +0100 Subject: [PATCH] Show atomics used in expressions --- R/telemetry.R | 8 ++++++-- tests/testthat/_snaps/fallback.md | 4 ++-- tests/testthat/_snaps/telemetry.md | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/R/telemetry.R b/R/telemetry.R index 41c2eb9e..2937ba6f 100644 --- a/R/telemetry.R +++ b/R/telemetry.R @@ -231,8 +231,12 @@ expr_to_json <- function(x, name_map) { expr_scrub <- function(x, name_map) { do_scrub <- function(xx, callee = FALSE) { - if (is.null(xx)) { - return(NULL) + if (is.character(xx)) { + return("") + } else if (is.factor(xx)) { + return("") + } else if (is.atomic(xx)) { + return(xx) } else if (is_symbol(xx)) { if (callee) { return(xx) diff --git a/tests/testthat/_snaps/fallback.md b/tests/testthat/_snaps/fallback.md index 0b355ebc..b432bfe3 100644 --- a/tests/testthat/_snaps/fallback.md +++ b/tests/testthat/_snaps/fallback.md @@ -81,7 +81,7 @@ a, label = TRUE)) Message i dplyr fallback recorded - {"version":"0.3.1","message":"wday(label = ) not supported","name":"mutate","x":{"...1":"Date"},"args":{"dots":{"...2":"...3::...4(...1, label = \"Don't know how to scrub logical\")"},".by":"NULL",".keep":["all","used","unused","none"]}} + {"version":"0.3.1","message":"wday(label = ) not supported","name":"mutate","x":{"...1":"Date"},"args":{"dots":{"...2":"...3::...4(...1, label = TRUE)"},".by":"NULL",".keep":["all","used","unused","none"]}} Output # A tibble: 1 x 2 a b @@ -109,7 +109,7 @@ a, format = "%Y-%m-%d", tz = "CET")) Message i dplyr fallback recorded - {"version":"0.3.1","message":"strftime(tz = ) not supported","name":"mutate","x":{"...1":"Date"},"args":{"dots":{"...2":"strftime(...1, format = \"Don't know how to scrub character\", tz = \"Don't know how to scrub character\")"},".by":"NULL",".keep":["all","used","unused","none"]}} + {"version":"0.3.1","message":"strftime(tz = ) not supported","name":"mutate","x":{"...1":"Date"},"args":{"dots":{"...2":"strftime(...1, format = \"\", tz = \"\")"},".by":"NULL",".keep":["all","used","unused","none"]}} Output # A tibble: 1 x 2 a b diff --git a/tests/testthat/_snaps/telemetry.md b/tests/testthat/_snaps/telemetry.md index a3aafb09..92560bef 100644 --- a/tests/testthat/_snaps/telemetry.md +++ b/tests/testthat/_snaps/telemetry.md @@ -56,7 +56,7 @@ tibble(a = 1:3, b = 4:6) %>% as_duckplyr_df() %>% filter(a > 1, .by = b) Condition Error in `rel_try()`: - ! filter: {"version":"0.3.1","message":"Error in filter","name":"filter","x":{"...1":"integer","...2":"integer"},"args":{"dots":{"1":"...1 > \"Don't know how to scrub numeric\""},"by":"...2","preserve":false}} + ! filter: {"version":"0.3.1","message":"Error in filter","name":"filter","x":{"...1":"integer","...2":"integer"},"args":{"dots":{"1":"...1 > 1"},"by":"...2","preserve":false}} --- @@ -64,7 +64,7 @@ tibble(a = 1:3, b = 4:6) %>% as_duckplyr_df() %>% filter(a > 1, .preserve = TRUE) Condition Error in `rel_try()`: - ! filter: {"version":"0.3.1","message":"Error in filter","name":"filter","x":{"...1":"integer","...2":"integer"},"args":{"dots":{"1":"...1 > \"Don't know how to scrub numeric\""},"by":"NULL","preserve":true}} + ! filter: {"version":"0.3.1","message":"Error in filter","name":"filter","x":{"...1":"integer","...2":"integer"},"args":{"dots":{"1":"...1 > 1"},"by":"NULL","preserve":true}} # telemetry and full_join()