Commits


Neal Richardson authored and GitHub committed 1d9366f19e4
GH-18818: [R] Create a field ref to a field in a struct (#19706) This PR implements `$.Expression` and `[[.Expression` methods, such that if the Expression is a FieldRef, it returns a nested FieldRef. This required revising some assumptions in a few places, particularly that if an Expression is a FieldRef, it has a `name`, and that all FieldRefs correspond to a Field in a Schema. In the case where the Expression is not a FieldRef, it will create an Expression call to `struct_field` to extract the field, iff the Expression has a knowable `type`, the type is `StructType`, and the field name exists in the struct. Things not done because they weren't needed to get this working: * `Expression$field_ref()` take a vector to construct a nested ref * Method to return vector of nested components of a field ref in R Next steps for future PRs: * Wrap this in [tidyr::unpack()](https://tidyr.tidyverse.org/reference/pack.html) method (but unfortunately, unpack() is not a generic) * https://github.com/apache/arrow/issues/33756 * https://github.com/apache/arrow/issues/33757 * https://github.com/apache/arrow/issues/33760 * Closes: #18818 Authored-by: Neal Richardson <neal.p.richardson@gmail.com> Signed-off-by: Neal Richardson <neal.p.richardson@gmail.com>