Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-13799

[R] case_when error handling is capturing strings

    XMLWordPrintableJSON

Details

    Description

      This test, now unskipped since case_when supports string data, fails:

        expect_dplyr_equal(
          input %>%
            mutate(
              cw = case_when(!(!(!(lgl))) ~ factor(chr), TRUE ~ fct)
            ) %>%
            collect(),
          tbl
        )
      

      On inspection, it seems that `factor(chr)` is hitting `base::factor()`, which tries to call `unique()` on the Expression and that fails with "unique() applies only to vectors". This is getting propagated through to the resulting dataset column because `arrow_eval()` returns a `try-error` on error and `nse_funcs$case_when()` isn't checking for errors.

      cc icook

      Attachments

        Issue Links

          Activity

            People

              dragosmg Dragoș Moldovan-Grünfeld
              npr Neal Richardson
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 50m
                  2h 50m