Skip to content
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

Derive Clone for ObjectStore builders and Make URL Parsing Stricter (#3419) #3424

Merged
merged 2 commits into from
Jan 2, 2023

Conversation

tustvold
Copy link
Contributor

@tustvold tustvold commented Dec 31, 2022

Which issue does this PR close?

Closes #3419

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

No, this does not making any breaking changes to released APIs

FYI @roeap perhaps you would be able to review this 🙏

@github-actions github-actions bot added the object-store Object Store Interface label Dec 31, 2022
@tustvold tustvold changed the title Derive Clone for ObjectStore builders (#3419) Derive Clone for ObjectStore builders and Make URL Parsing Stricter (#3419) Dec 31, 2022
///
/// This is a separate member function to allow fallible computation to
/// be deferred until [`Self::build`] which in turn allows deriving [`Clone`]
fn parse_url(&mut self, url: &str) -> Result<()> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously invalid URLs would be silently ignored, they now result in an error which I think makes for a better UX

Copy link
Contributor

@winding-lines winding-lines left a comment

Choose a reason for hiding this comment

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

Love it, many thanks!

@@ -365,10 +368,10 @@ pub struct MicrosoftAzureBuilder {
tenant_id: Option<String>,
sas_query_pairs: Option<Vec<(String, String)>>,
authority_host: Option<String>,
url: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

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

The MicrosoftAzureBuilder is missing the Clone in the derive list.

},
_ => match prefix.split_once('.') {
// https://<bucket>.s3.<region>.amazonaws.com
Some((b, r)) if r.starts_with("s3.") => b,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we set region and virtual_hosted_style_request here before returning the bucket? Otherwise I think the user would have to set these separetely for things to work.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should make sure we cover this case with a test so we are sure it works / and it isn't broken in a future refactoring

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Code and tests looks good to me -- though I think we really should add some error coverage

assert_eq!(builder.bucket_name, Some("bucket".to_string()));

let builder =
AmazonS3Builder::new().with_url("https://bucket.s3.region.amazonaws.com");
let mut builder = AmazonS3Builder::new();
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps should we add a test for parsing errors?

(also applies to the other test_urls functions)

},
_ => match prefix.split_once('.') {
// https://<bucket>.s3.<region>.amazonaws.com
Some((b, r)) if r.starts_with("s3.") => b,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should make sure we cover this case with a test so we are sure it works / and it isn't broken in a future refactoring

Copy link
Contributor

@roeap roeap left a comment

Choose a reason for hiding this comment

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

👍

@winding-lines
Copy link
Contributor

Many thanks! I have been looking into the verde support. The structs re-exported from http::headers do not work out of the box but I am close, I think. Will submit a PR after this one, unless @tustvold already started on it.

@tustvold tustvold merged commit 1889e33 into apache:master Jan 2, 2023
@ursabot
Copy link

ursabot commented Jan 2, 2023

Benchmark runs are scheduled for baseline = b371f41 and contender = 1889e33. 1889e33 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
object-store Object Store Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Derive Clone for the builders in object-store.
5 participants