thisisnic commented on code in PR #12826:
URL: https://github.com/apache/arrow/pull/12826#discussion_r941801237
##########
r/R/util.R:
##########
@@ -217,8 +225,27 @@ handle_csv_read_error <- function(e, schema, call) {
"header being read in as data."
)
)
+ abort(msg, call = call)
+ }
+}
+
+# This function only raises an error if
+# the appropriate string was found and so errors must be raised manually after
+# calling this if matching error not found
+# TODO: Refactor as part of ARROW-17355 to prevent potential missed errors
+handle_augmented_field_misuse <- function(e, call) {
+ msg <- conditionMessage(e)
+ if (grepl("No match for FieldRef.Name(__filename)", msg, fixed = TRUE)) {
+ msg <- c(
+ msg,
+ i = paste(
+ "Augmented fields such as 'filename' must",
+ "only be used with with Dataset objects which have",
+ "not been aggregated or joined."
Review Comment:
That's a lot clearer, thank you! I've updated the error to incorporate both
that, and the two different ways of referring to the `__filename` variable.
--
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]