Commits


Dragos Moldovan-Grünfeld authored and Jonathan Keane committed 07ec0a12d43
ARROW-14461 [R] write_dataset() allows users to pass invalid additional arguments This PR aims to add checks to arguments passed to `write_dataset()` via `...`, conditional on the value passed for `format`. The code below should **not** run without a complaint. ```r td <- tempfile() dir.create(td) write_dataset(iris, td, format = "feather", arg_that_doesnt_make_sense = "blah-blah") ``` Currently `write_dataset()` supports 5 formats (`"parquet"`, `"feather"`, `"arrow"`, `"ipc"`, `"csv"`). Ultimately all formats use `FileWriteOptions$update()`. `"csv"` is the only one that errors on non-relevant additional arguments passed via `...` (without checks). `"arrow"`, `"ipc"` and `"feather"` all use the same `type` (`dataset___FileWriteOptions__type_name`). After the implementation in this PR, the same code will error: ```r > write_dataset(iris, td, format = "feather", arg_that_doesnt_make_sense = "blah-blah") Error: `arg_that_doesnt_make_sense` is not a valid argument for your chosen `format`. ℹ Supported arguments: `use_legacy_format`, `metadata_version`, `codec`, and `null_fallback`. ``` Closes #12170 from dragosmg/write_dataset_arg_name_validation Lead-authored-by: Dragos Moldovan-Grünfeld <dragos.mold@gmail.com> Co-authored-by: Dragoș Moldovan-Grünfeld <dragos.mold@gmail.com> Signed-off-by: Jonathan Keane <jkeane@gmail.com>