MichaelChirico opened a new pull request, #46878:
URL: https://github.com/apache/arrow/pull/46878

   Closes #45098.
   
   A number of notes:
   
    - I basically had Gemini write this (on my free personal account). It did 
95% of the work, from one prompt, then I tidied up the results and fixed the 
tests. It looks reasonably similar to the `dplyr::case_when()` code. I'm not 
sure arrow/Apache policy on AI-generated code. The part I understand least is 
the `mask` and the `Expression` class.
    - This basically introduces a new `Suggests` dependency on {data.table}. 
I'm not sure the package's policy on new dependencies, etc. Please advise.
    - For now, I shoehorned it alongside the existing {dplyr} translations. My 
first thought was to put it in a file like R/data.table-funcs-conditional.R, 
but the registration in the current file, `register_bindings_conditional`, did 
not specify anything about {dplyr}. I rely on the maintainers' judgment for how 
best to organize this.
    - Because {data.table} is still `Suggests`, I didn't want to `library()` 
it, hence all of the tests use `data.table::fcase()`; it might be preferable to 
use the unqualified name in some tests, I'm not sure.
    - `data.table::fcase()` supports `default = <vector>`, as does 
`dplyr::case_when(.default=)`, but I guess it's a limitation of the arrow 
backend not to support a vector here.
   
   ### Rationale for this change
   
   See #45098
   
   ### What changes are included in this PR?
   
   `data.table::fcase()` gets translated similar to how `dplyr::case_when()` is
   
   ### Are these changes tested?
   
   Yes, included
   
   ### Are there any user-facing changes?
   
   Yes, `fcase()` can now be executed _via_ arrow instead of relying on 
data.table.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to