You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/01/31 14:34:37 UTC

[GitHub] [arrow] thisisnic commented on a change in pull request #12277: ARROW-15480: [R] Expand on schema/colnames mismatch error messages

thisisnic commented on a change in pull request #12277:
URL: https://github.com/apache/arrow/pull/12277#discussion_r795727853



##########
File path: r/R/dataset-format.R
##########
@@ -133,10 +133,36 @@ CsvFileFormat$create <- function(...,
   schema_names <- names(schema)
 
   if (!is.null(schema) & !identical(schema_names, column_names)) {
+    missing_from_schema <- setdiff(column_names, schema_names)
+    missing_from_colnames <- setdiff(schema_names, column_names)
+    message_colnames <- NULL
+    message_schema <- NULL
+    message_order <- NULL
+
+    if (length(missing_from_colnames) > 0) {
+      message_colnames <- paste(
+        oxford_paste(missing_from_colnames, quote_symbol = "`"),
+        "not present in `column_names`"
+      )
+    }
+
+    if (length(missing_from_schema) > 0) {
+      message_schema <- paste(
+        oxford_paste(missing_from_schema, quote_symbol = "`"),
+        "not present in schema"

Review comment:
       Yeah, I was thinking of schema as in the type of object here instead of the parameter name, but will update as backticks remove ambiguity.




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org