thisisnic commented on code in PR #12826:
URL: https://github.com/apache/arrow/pull/12826#discussion_r932678039
##########
r/R/dplyr-collect.R:
##########
@@ -107,6 +109,14 @@ implicit_schema <- function(.data) {
.data <- ensure_group_vars(.data)
old_schm <- .data$.data$schema
+ missing_fields <- .data$selected_columns[
+ setdiff(
+ names(.data$selected_columns),
+ names(old_schm)
+ )]
+
+ purrr::iwalk(missing_fields, ~if(.x$field_name == "__filename") old_schm <<-
old_schm$AddField(0, field(.y, string())))
Review Comment:
I added this in here so that the code on line 121 works, but it currently
fails with:
```
Error: Invalid: No match for FieldRef.Name(__filename) in file: string
int: int32
dbl: double
lgl: bool
chr: string
fct: dictionary<values=string, indices=int32, ordered=0>
ts: timestamp[us, tz=UTC]
group: int32
other: string
/home/nic2/arrow/cpp/src/arrow/type.h:1800 CheckNonEmpty(matches, root)
/home/nic2/arrow/cpp/src/arrow/compute/exec/expression.cc:429
ref->FindOne(in)
```
I'm not totally sure why, perhaps I'm missing understanding something about
Fields and FieldRefs.
--
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]