-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Fixes to S3 Native Lister with correct Error propagation #1401
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#![feature(async_closure)] | ||
|
||
#![feature(let_chains)] | ||
mod azure_blob; | ||
mod google_cloud; | ||
mod http; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -690,7 +690,6 @@ impl ObjectSource for S3LikeSource { | |
) -> super::Result<LSResult> { | ||
let parsed = url::Url::parse(path).with_context(|_| InvalidUrlSnafu { path })?; | ||
let delimiter = delimiter.unwrap_or("/"); | ||
log::warn!("{:?}", parsed); | ||
|
||
let bucket = match parsed.host_str() { | ||
Some(s) => Ok(s), | ||
|
@@ -701,22 +700,25 @@ impl ObjectSource for S3LikeSource { | |
}?; | ||
let key = parsed.path(); | ||
|
||
let key = key | ||
.strip_prefix('/') | ||
.map(|k| k.strip_suffix('/').unwrap_or(k)); | ||
let key = key.unwrap_or(""); | ||
|
||
let key = key.strip_prefix('/').unwrap_or(""); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm this seems like this will coerce the Shouldn't this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The UrlParse library leaves the prefix when your parse the url so "foo/bar" is hostname="foo", key="/bar". so if theres no prefix then it means it's an empty string. |
||
let key = if key.is_empty() { | ||
"".to_string() | ||
} else { | ||
let key = key.strip_suffix('/').unwrap_or(key); | ||
format!("{key}/") | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like this might be more simply expressed as: let key = key.strip_prefix('/').unwrap_or(key);
let key = if !key.ends_with('/') { format!("{key}/") } else { key }; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I wanted to take care of here is to drop trailing slashes but ensure that there's atleast one. looks like the right call was actually |
||
// assume its a directory first | ||
let lsr = { | ||
let permit = self | ||
.connection_pool_sema | ||
.acquire() | ||
.await | ||
.context(UnableToGrabSemaphoreSnafu)?; | ||
|
||
self._list_impl( | ||
permit, | ||
bucket, | ||
key, | ||
&key, | ||
delimiter.into(), | ||
continuation_token.map(String::from), | ||
&self.default_region, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line appears to be redundant now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in https://github.com/Eventual-Inc/Daft/pull/1404/files