Skip to content

Conversation

@tustvold
Copy link
Contributor

@tustvold tustvold commented May 16, 2023

Which issue does this PR close?

Closes apache/arrow-rs-object-store#165

Rationale for this change

I spent a non-trivial amount of time helping diagnose an issue with apache/datafusion#6183 that boiled down to a head request being made instead of a list request, because the ListingTableUrl didn't end with a /. Normally this would have returned a 404 NotFound which would have made the issue easy to identify, however, because it was an Azure hierarchical namespace this didn't occur.

LocalFileSystem also runs into a similar issue.

What changes are included in this PR?

Are there any user-facing changes?

LocalFileSystem and MicrosoftAzure will no longer return directories for get and head requests

let file = File::open(path).map_err(|e| {
if e.kind() == std::io::ErrorKind::NotFound {
Error::NotFound {
let file = match File::open(path).and_then(|f| Ok((f.metadata()?, f))) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is potentially slightly unfortunate, in that we require an additional syscall, but I couldn't find a mechanism to only open files

@tustvold tustvold force-pushed the mask-directories branch from 43cca27 to 3ff5dda Compare May 16, 2023 20:09
Err(crate::Error::NotFound {
path: path.to_string(),
source: format!(
"Not a directory, got x-ms-resource-type: {}",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be, "Not a file"?

Copy link
Contributor Author

@tustvold tustvold May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops lol

Edit: fixed, good spot

@tustvold tustvold merged commit 98867f5 into apache:master May 17, 2023
alamb pushed a commit to alamb/arrow-rs that referenced this pull request Mar 20, 2025
* Return NotFound for directories in Head and Get (#4230)

* Fix webdav

* Fix error message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ObjectStore::head Returns Directory for LocalFileSystem and Hierarchical Azure

3 participants