drin commented on code in PR #14071:
URL: https://github.com/apache/arrow/pull/14071#discussion_r983924438
##########
cpp/src/arrow/engine/substrait/relation_internal.cc:
##########
@@ -212,43 +204,102 @@ Result<DeclarationInfo> FromProto(const substrait::Rel&
rel, const ExtensionSet&
"non-default
substrait::ReadRel::LocalFiles::FileOrFiles::length");
}
- path = path.substr(7);
+ // Extract and parse the read relation's source URI
+ ::arrow::internal::Uri item_uri;
switch (item.path_type_case()) {
- case substrait::ReadRel::LocalFiles::FileOrFiles::kUriPath: {
- ARROW_ASSIGN_OR_RAISE(auto file, filesystem->GetFileInfo(path));
- if (file.type() == fs::FileType::File) {
- files.push_back(std::move(file));
- } else if (file.type() == fs::FileType::Directory) {
- fs::FileSelector selector;
- selector.base_dir = path;
- selector.recursive = true;
- ARROW_ASSIGN_OR_RAISE(auto discovered_files,
- filesystem->GetFileInfo(selector));
- std::move(files.begin(), files.end(),
std::back_inserter(discovered_files));
- }
+ case substrait::ReadRel::LocalFiles::FileOrFiles::kUriPath:
+ RETURN_NOT_OK(item_uri.Parse(item.uri_path()));
break;
- }
+
+ case substrait::ReadRel::LocalFiles::FileOrFiles::kUriFile:
+ RETURN_NOT_OK(item_uri.Parse(item.uri_file()));
+ break;
+
+ case substrait::ReadRel::LocalFiles::FileOrFiles::kUriFolder:
+ RETURN_NOT_OK(item_uri.Parse(item.uri_folder()));
+ break;
+
+ default:
+ RETURN_NOT_OK(item_uri.Parse(item.uri_path_glob()));
+ break;
+ }
+
+ // Validate the URI before processing
+ if (!item_uri.is_file_scheme()) {
+ return Status::NotImplemented("substrait::ReadRel::LocalFiles item
(",
+ item_uri.ToString(),
+ ") with non-filesystem scheme
(file:///)");
Review Comment:
mmm.. I don't think S3 is a filesystem, but changing `filesystem` back to
`file` here actually makes more sense
--
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]