raulcd commented on code in PR #50044:
URL: https://github.com/apache/arrow/pull/50044#discussion_r3402380471


##########
cpp/src/arrow/testing/examplefs.cc:
##########
@@ -26,12 +29,41 @@ namespace arrow::fs {
 
 auto kExampleFileSystemModule = ARROW_REGISTER_FILESYSTEM(
     "example",
-    [](const Uri& uri, const io::IOContext& io_context,
+    [](const Uri& uri, const FileSystemFactoryOptions& options,
+       const io::IOContext& io_context,
        std::string* out_path) -> Result<std::shared_ptr<FileSystem>> {
       constexpr std::string_view kScheme = "example";
       EXPECT_EQ(uri.scheme(), kScheme);
       auto local_uri = "file" + uri.ToString().substr(kScheme.size());
-      return FileSystemFromUri(local_uri, io_context, out_path);
+      ARROW_ASSIGN_OR_RAISE(auto fs, FileSystemFromUri(local_uri, io_context, 
out_path));
+      for (const auto& [key, value] : options) {
+        EXPECT_TRUE(value.has_value());
+        if (key == "example_option_string") {
+          if (const auto* s = std::any_cast<std::string>(&value)) {
+            if (out_path != nullptr) *out_path += "/" + *s;
+          } else {
+            ADD_FAILURE() << "example_option_string has wrong type";
+          }
+        } else if (key == "example_option_int") {
+          if (const auto* i = std::any_cast<int>(&value)) {
+            if (out_path != nullptr) *out_path += "/" + std::to_string(*i);
+          } else {
+            ADD_FAILURE() << "example_option_int has wrong type";
+          }
+        } else if (key == "example_typed_option") {
+          if (const auto* opt =
+                  std::any_cast<std::shared_ptr<ExampleTypedOption>>(&value)) {
+            if (out_path != nullptr) {
+              *out_path += "/" + std::to_string((*opt)->value());
+            }
+          } else if (out_path != nullptr) {
+            *out_path += "/typed_cast_failed";
+          }

Review Comment:
   over further inspection I think a minor change here makes sense to be 
consistent with the other test cases, just pushed it.



-- 
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]

Reply via email to